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 许可协议。转载请注明出处!
相关文章
2024年,提升Windows开发和使用体验的实践经验 - RIME输入法
上一篇文章介绍了 Windows 下的包管理器,本文继续介绍输入法。 事实上 Windows 的输入法生态比 Linux/Mac 丰富很多,不过很多国产输入法存在窃取隐私、植入广告、乱安装流氓软件等问题,现在有开源的 RIME 输入法可以选择,何必受这气呢
2024-02-29 · Windows · 约 1 分钟
在Windows上将git与ssh-agent搭配使用
Windows git 还自带 ssh?真是老土的兼容性思路。一行配置就能解决,不过得先管好 ssh-agent 的连接。 ProxyCommand 居然又添乱,难怪老出毛病。
2025-08-21 · Windows · 约 1 分钟
使用twinkle-tray快捷调整多个显示器的亮度
自从安装了这个小工具,我再也没用过笔记本键盘上的快捷键了~
2025-01-26 · Windows · 约 1 分钟
Windows10-快捷键大全,整理+排版
前言 偶然在微软官网看到的,整理了一下,非常全面。不只有Windows10能用,大部分快捷键在7/8/8.1里都是通用的。 发现这东西对提高效率帮助很大啊,下面是整理之后的。 复制、粘贴及其他常规的键盘快捷方式 | 按键 | 操作
2021-12-18 · Windows · 约 1 分钟
讨论
共 0 条加载评论中…