Can Windows also have a good command line? PowerShell+Terminal tweaking notes (Version 1.0)
Windows has always been known for its easy-to-learn graphical interface, so its command-line support has often been criticized, far behind that of Linux or macOS. This situation has improved in recent updates of Windows 10, especially after Microsoft officially released the powerful Windows Terminal tool~ Therefore, in response to the question in the title, it can only be said that it is "more than adequate." This article introduces several ways to work with the command line. Effect picture ~~Borrowing an official screenshot, hopefully, no one will notice~~ It is recommended to first thoroughly read the official documentation: https
目录5 个章节
PS: This article was written in 2021. Now it's 2024, and there have been many new developments. I will continue to update this in upcoming articles.
Preface
Windows has always been known for its easy-to-use graphical interface, which is why its command-line support has long been criticized, falling far behind Linux or macOS. This situation has improved in recent Windows 10 updates, especially after Microsoft officially released Windows Terminal, a powerful tool~
So, regarding the question in the title, one can only say, "it's passable." This article introduces several ways to tinker with the command line.
Screenshot
Borrowing an official screenshot, hope nobody notices

It is recommended to first thoroughly read the official documentation (官方文档): https://docs.microsoft.com/zh-cn/windows/terminal/
Scoop: A Package Manager for Windows
Don't be envious of the convenient apt and yum on Linux. Windows also has some excellent package managers, such as Chocolatey, the official WinGet, and the one introduced here, Scoop. Compared to Chocolatey, Scoop's package repositories are community-maintained and open-source, offering better security and being much more extensive than the official WinGet. If that's not enough, you can even add your own software sources, similar to apt's PPA repositories.
Official Website: https://scoop.sh/
Installation:
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iwr -useb get.scoop.sh | iex
oh-my-posh & powerline
If you're familiar with oh-my-zsh, you'll recognize this oh-my-xxx project~ It's a must-have on Windows~
First, download and install the powerline font. These fonts can be installed from the Cascadia Code GitHub releases page.
Enter commands to install the PowerShell plugin. posh-git requires Git support. If you don't already have it, install Git for Windows.
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Open your PowerShell profile with notepad $PROFILE and enter the following content:
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox
Open the terminal configuration and modify the font, for example:
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"fontFace": "Cascadia Code PL",
"hidden": false
},
The effect after configuration:

Reference materials: https://docs.microsoft.com/en-us/windows/terminal/tutorials/powerline-setup
Using sudo (gsudo)
When using PowerShell on Windows, some operations require administrator privileges. Unlike Linux, where you can simply use the sudo command to elevate privileges, Windows often requires right-clicking the Start menu and selecting the PowerShell admin mode.
Not only is this inconvenient, but it might also lead impatient users to smash their keyboards.
However, where there's a will, there's a way. That's where the open-source gsudo comes in handy, allowing easy privilege escalation on Windows. Here's how to install it:
Installation:
PowerShell -Command "Set-ExecutionPolicy RemoteSigned -scope Process; iwr -useb https://raw.githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1 | iex"
Once installed, you can directly use the sudo command in PowerShell to elevate privileges. You can also add an administrator-privilege tab in Terminal. Let's see how to configure it.
Add the following entry to your Terminal configuration file:
"list": [
{
"guid": "{41dd7a51-f0e1-4420-a2ec-1a7130b7e950}",
"name": "Windows PowerShell Elevated",
"commandline": "gsudo.exe powershell.exe",
"hidden": false,
"colorScheme": "Solarized Dark",
"fontFace": "Fira Code",
"icon" : "https://i.imgur.com/Giuj3FT.png"
},
//...
]
Reference: https://blog.csdn.net/weixin_39858881/article/details/107026065
_EOF_
Can Windows also have a good command line? PowerShell+Terminal tweaking notes (Version 1.0)
- 本文作者:
- 程序设计实验室
- 版权声明:
- 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
相关文章
这是演习:Win10蓝屏,随你召唤
蓝屏似乎是很多IT之家用户不希望看到的东西,虽然在Win10中你还可以扫描屏幕下方二维码参与微软互动赢取大……那个,蓝屏的好处就是为专业人员提供问题信息,比如当前的内存转储,有助于排查和解决问题。当然,可能光是默认蓝屏给出的信息不够,此时可以开启Win10蓝屏详细信息显示。 ▲这二维码居然“上位”了……VM12虚拟机测试结果 微软在Windows10中安排了手动“调取”蓝屏的方式,那就是**按住右
2021-12-18 · Windows · 约 1 分钟
修复winget命令找不到的问题
微软官方包管理器winget在Windows 10 1809以上版本中,用于快速安装、更新和管理应用程序。本文介绍了因系统环境变化导致winget命令失效的问题,分析了可能原因,并提供了解决方案及预防措施,包括修复命令、定期更新检查、备份环境变量等。
2025-04-04 · Windows · 约 1 分钟
使用EarTrumpet代替windows默认的音量调节功能
Windows 默认的音量调节功能挺弱的,要分别调节各个应用的音量得进入二级菜单,麻烦得很。有了这个功能就很方便了
2025-01-26 · Windows · 约 1 分钟
使用twinkle-tray快捷调整多个显示器的亮度
自从安装了这个小工具,我再也没用过笔记本键盘上的快捷键了~
2025-01-26 · Windows · 约 1 分钟
讨论
共 0 条加载评论中…