4

默认的 PowerShell Core (pwsh.exe) 控制台看起来就像命令提示符 (cmd.exe) 控制台。此外,PowerShell Core 控制台也有同样的限制,即不能正确显示外来字符(例如:韩语、日语等),除非我更改了我不想这样做的字体。另一方面,Windows 终端可以正确显示外来字符,因为它默认使用 UTF-8。

我使用 AutoHotKey 启动 PowerShell 脚本 (.ps1),我想知道是否可以在 Windows 终端中打开该脚本并自动使用 PowerShell Core?我需要执行任何配置更改吗?

4

1 回答 1

6

是的,您可以执行类似的操作,启动 Windows 终端并在您的配置中添加 PowerShell 核心作为默认值,可以使用键访问您可以使用一种形式的电源外壳核心crtl+,来更改 id 。defaultProfile

下面的例子:

{
"$schema": "https://aka.ms/terminal-profiles-schema",

"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",

"profiles":
{
    "defaults":
    {
        // Put settings here that you want to apply to all profiles
    },
    "list":
    [
        {
            // Make changes here to the powershell.exe profile
            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
            "name": "Windows PowerShell",
            "commandline": "powershell.exe",
            "hidden": false
        },
        {
            // Make changes here to the cmd.exe profile
            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
            "name": "cmd",
            "commandline": "cmd.exe",
            "hidden": false
        },
        {
            "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
            "hidden": false,
            "name": "Azure Cloud Shell",
            "source": "Windows.Terminal.Azure"
        },
        {
            "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
            "hidden": false,
            "name": "PowerShell",
            "source": "Windows.Terminal.PowershellCore"
        }
    ]
},
于 2020-03-12T18:11:17.413 回答