Windows Terminal 笔记

为 Windows Terminal 来点 Scoop

powershell
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex

为 Windows Terminal 来点 sudo

在 Windows 中像 Linux 一样优雅的使用 sudo 赋权

bash
scoop install sudo --global

为 Windows Terminal 来点 gsudo


在 Windows Terminal 中的新标签页中,添加以管理员模式打开的终端标签。

链接地址:https://github.com/gerardog/gsudo/releases

配置文件示例:

json
{
                "altGrAliasing": true,
                "antialiasingMode": "grayscale",
                "closeOnExit": "automatic",
                "colorScheme": "Campbell",
                "commandline": "gsudo.exe %SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
                "cursorShape": "bar",
                "elevate": false,
                "font": 
                {
                    "face": "Cascadia Mono",
                    "size": 12
                },
                "guid": "{da453ae5-ea60-4ea2-8c95-11529d16b798}",
                "hidden": false,
                "historySize": 9001,
                "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
                "name": "Windows PowerShell Elevated",
                "padding": "8, 8, 8, 8",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "useAcrylic": false
            }

现在也不用那么麻烦了,可以直接在设置里面改了


GUID怎么获得?

在 Power Shell 中输入 New-Guid 即可

以下留着以后折腾○( ^皿^)っHiahiahia…

新 on-my-posh 主题配置

powershell
Import-Module posh-git 
Import-Module oh-my-posh 
#Set-Theme Sorin
Set-PoshPrompt Sorin

如果提示禁止执行脚本之类的错误信息,请将脚本执行策略更改为RemoteSigned。具体方法为使用具有管理员权限的PowerShell,然后输入

Set-ExecutionPolicy RemoteSigned