windowspowershellwindows-terminal

How to fix the error 0x800700c1 when launching `powershell.exe' in Windows Terminal?


Recently I got the following error in my Windows Terminal:

[error 0x800700c1 when launching "C:\Users\Dry-C Desktop\AppData\Local\Microsoft\WindowsApps\Microsoft.PowerShell_8wekyb3d8bbwe\pwsh.exe"]

How do Image of the Issue - error 0x800700c1

How do I want to know, how can I solve it to fix this?


Solution

  • I solved this issue by changing the Windows Terminal settings.json config file by adding the following:

    1 - Find the settings on: Windows Terminal arrow down nearby the tab(s), Click to the settings button, and Click to Open JSON File field.

    2 - Add this command to the config file like the example below:

    "commandline": "\"C:\\Users\\Your Machine actual Username\\AppData\\Local\\Microsoft\\WindowsApps\\Microsoft.PowerShell_8wekyb3d8bbwe\\pwsh.exe\""
    

    The original Windows Terminal config:

    {
       ...
       "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
       "hidden": false,
       "name": "PowerShell",
       "source": "Windows.Terminal.PowershellCore",
    },
    ...
    

    After Change:

    {
       ...
       "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
       "hidden": false,
       "name": "PowerShell",
       "source": "Windows.Terminal.PowershellCore",
       "commandline": "\"C:\\Users\\Your Machine actual Username\\AppData\\Local\\Microsoft\\WindowsApps\\Microsoft.PowerShell_8wekyb3d8bbwe\\pwsh.exe\"",
    },
    ...
    

    Don't forget to change You Machine Actual Username in the commandline field.

    Ref: https://github.com/microsoft/terminal/issues/6082#issuecomment-1001226003

    Or you can follow this blog suggestion that works as well: https://blog.darrenjrobinson.com/error-0x800700c1-when-launching-cprogram-filespowershell7pwsh-exe/