howdoicode
howdoicode

Reputation: 961

Can PowerShell Core use Windows Terminal instead of the pwsh.exe console?

The default PowerShell Core (pwsh.exe) console looks just like the Command Prompt (cmd.exe) console. In addition, the PowerShell Core console has same the limitation of not properly displaying foreign characters (ex: Korean, Japanese, etc.), unless I change the font, which I don't want to do. On the other hand, Windows Terminal displays foreign characters properly since it uses UTF-8 by default.

I use AutoHotKey to start a PowerShell script (.ps1), and I want to know if it's possible to have that script open in Windows Terminal and use PowerShell Core automatically? Sre there any configuration changes I need to perform?

Upvotes: 5

Views: 4461

Answers (1)

Adrian Badarau
Adrian Badarau

Reputation: 153

Yes, you can do something similar, start windows terminal and add PowerShell core as the default in your configuration, accessible using the crtl+, keys you can just change the id of the defaultProfile with the one form the power shell core.

Example below:

{
"$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"
        }
    ]
},

Upvotes: 6

Related Questions