when i open the windows terminal ,its show [error 0x80070002 when launching powershell.exe'] #5931

Closed
opened 2026-01-31 00:25:41 +00:00 by claunia · 29 comments
Owner

Originally created by @chenbb3 on GitHub (Jan 15, 2020).

when i open the windows terminal ,its show [error 0x80070002 when launching powershell.exe']

Originally created by @chenbb3 on GitHub (Jan 15, 2020). when i open the windows terminal ,it`s show [error 0x80070002 when launching `powershell.exe']
claunia added the Needs-TriageNeeds-Tag-FixNeeds-Author-Feedback labels 2026-01-31 00:25:41 +00:00
Author
Owner

@pcchin commented on GitHub (Jan 15, 2020):

A similar problem occured to me when using Python. When I set commandline as "python3.8", it would show [error 0x80070002 ...]. However, when I set commandline as "python3" the issue does not occur.

@pcchin commented on GitHub (Jan 15, 2020): A similar problem occured to me when using Python. When I set commandline as "python3.8", it would show [error 0x80070002 ...]. However, when I set commandline as "python3" the issue does not occur.
Author
Owner

@DHowett-MSFT commented on GitHub (Jan 15, 2020):

It seems that your PATH environment variable may be damaged and not contain the Windows PowerShell directory.

@pc-chin is your python executable named python3.8.exe or is it named python3.exe? If it is python3.exe, you will never be able to call it python3.8 and have it work properly.

@DHowett-MSFT commented on GitHub (Jan 15, 2020): It seems that your `PATH` environment variable may be damaged and not contain the Windows PowerShell directory. @pc-chin is your python executable named `python3.8.exe` or is it named `python3.exe`? If it is `python3.exe`, you will never be able to call it `python3.8` and have it work properly.
Author
Owner

@DeshmukhMalhar commented on GitHub (Jan 16, 2020):

It seems that your PATH environment variable may be damaged and not contain the Windows PowerShell directory.

@pc-chin is your python executable named python3.8.exe or is it named python3.exe? If it is python3.exe, you will never be able to call it python3.8 and have it work properly.

I have the same problem. I know that my PATH variables are damaged, WT was not working before 0.8.10091.0

I think in some windows update my PATH got messed up. I have faced many problems because of it. Currently I cannot reinstall everything, Can we fix the path variables ?

When I try to launch PS from cmd, cmd cannot find PS, but the same is not true for my Windows sandbox env.

I am just hoping to fix my PATH, and use WT easily.

Thanks,
Malhar

Edit:

image

Windows sandbox

image

My current env

image
my WT
CMD and WSL work correctly in WT

@DeshmukhMalhar commented on GitHub (Jan 16, 2020): > > > It seems that your `PATH` environment variable may be damaged and not contain the Windows PowerShell directory. > > @pc-chin is your python executable named `python3.8.exe` or is it named `python3.exe`? If it is `python3.exe`, you will never be able to call it `python3.8` and have it work properly. I have the same problem. I know that my PATH variables are damaged, WT was not working before 0.8.10091.0 I think in some windows update my PATH got messed up. I have faced many problems because of it. Currently I cannot reinstall everything, Can we fix the path variables ? When I try to launch PS from cmd, cmd cannot find PS, but the same is not true for my Windows sandbox env. I am just hoping to fix my PATH, and use WT easily. Thanks, Malhar Edit: ![image](https://user-images.githubusercontent.com/16190134/72495049-b5155c00-384b-11ea-8d9e-bec8960910b1.png) Windows sandbox ![image](https://user-images.githubusercontent.com/16190134/72495089-c8282c00-384b-11ea-8751-5a928116bf2a.png) My current env ![image](https://user-images.githubusercontent.com/16190134/72495152-e68e2780-384b-11ea-88b1-da89963d50be.png) my WT CMD and WSL work correctly in WT
Author
Owner

@DeshmukhMalhar commented on GitHub (Jan 16, 2020):

It seems that your PATH environment variable may be damaged and not contain the Windows PowerShell directory.
@pc-chin is your python executable named python3.8.exe or is it named python3.exe? If it is python3.exe, you will never be able to call it python3.8 and have it work properly.

I have the same problem. I know that my PATH variables are damaged, WT was not working before 0.8.10091.0

I think in some windows update my PATH got messed up. I have faced many problems because of it. Currently I cannot reinstall everything, Can we fix the path variables ?

When I try to launch PS from cmd, cmd cannot find PS, but the same is not true for my Windows sandbox env.

I am just hoping to fix my PATH, and use WT easily.

Thanks,
Malhar

Edit:

image

Windows sandbox

image

My current env

image
my WT
CMD and WSL work correctly in WT

After updating my PATH with %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ at the top of the list, it seems to be working now
image
My CMD can call PS now !

image
WT runs PS

@DeshmukhMalhar commented on GitHub (Jan 16, 2020): > > > > It seems that your `PATH` environment variable may be damaged and not contain the Windows PowerShell directory. > > @pc-chin is your python executable named `python3.8.exe` or is it named `python3.exe`? If it is `python3.exe`, you will never be able to call it `python3.8` and have it work properly. > > I have the same problem. I know that my PATH variables are damaged, WT was not working before 0.8.10091.0 > > I think in some windows update my PATH got messed up. I have faced many problems because of it. Currently I cannot reinstall everything, Can we fix the path variables ? > > When I try to launch PS from cmd, cmd cannot find PS, but the same is not true for my Windows sandbox env. > > I am just hoping to fix my PATH, and use WT easily. > > Thanks, > Malhar > > Edit: > > ![image](https://user-images.githubusercontent.com/16190134/72495049-b5155c00-384b-11ea-8d9e-bec8960910b1.png) > > Windows sandbox > > ![image](https://user-images.githubusercontent.com/16190134/72495089-c8282c00-384b-11ea-8751-5a928116bf2a.png) > > My current env > > ![image](https://user-images.githubusercontent.com/16190134/72495152-e68e2780-384b-11ea-88b1-da89963d50be.png) > my WT > CMD and WSL work correctly in WT After updating my PATH with `%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\` at the top of the list, it seems to be working now ![image](https://user-images.githubusercontent.com/16190134/72495693-6ec0fc80-384d-11ea-82ca-40c48b6e2d73.png) My CMD can call PS now ! ![image](https://user-images.githubusercontent.com/16190134/72495720-86988080-384d-11ea-9e19-6e667d68d09d.png) WT runs PS
Author
Owner

@ghost commented on GitHub (Jan 20, 2020):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Jan 20, 2020): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@OnurGumus commented on GitHub (Feb 15, 2020):

This bug still exists and should be reopened.

@OnurGumus commented on GitHub (Feb 15, 2020): This bug still exists and should be reopened.
Author
Owner

@DeshmukhMalhar commented on GitHub (Feb 16, 2020):

It seems that your PATH environment variable may be damaged and not contain the Windows PowerShell directory.
@pc-chin is your python executable named python3.8.exe or is it named python3.exe? If it is python3.exe, you will never be able to call it python3.8 and have it work properly.

I have the same problem. I know that my PATH variables are damaged, WT was not working before 0.8.10091.0
I think in some windows update my PATH got messed up. I have faced many problems because of it. Currently I cannot reinstall everything, Can we fix the path variables ?
When I try to launch PS from cmd, cmd cannot find PS, but the same is not true for my Windows sandbox env.
I am just hoping to fix my PATH, and use WT easily.
Thanks,
Malhar
Edit:
image
Windows sandbox
image
My current env
image
my WT
CMD and WSL work correctly in WT

After updating my PATH with %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ at the top of the list, it seems to be working now
image
My CMD can call PS now !

image
WT runs PS

Have you tried this solution ?

@DeshmukhMalhar commented on GitHub (Feb 16, 2020): > > > > > It seems that your `PATH` environment variable may be damaged and not contain the Windows PowerShell directory. > > > @pc-chin is your python executable named `python3.8.exe` or is it named `python3.exe`? If it is `python3.exe`, you will never be able to call it `python3.8` and have it work properly. > > > > > > I have the same problem. I know that my PATH variables are damaged, WT was not working before 0.8.10091.0 > > I think in some windows update my PATH got messed up. I have faced many problems because of it. Currently I cannot reinstall everything, Can we fix the path variables ? > > When I try to launch PS from cmd, cmd cannot find PS, but the same is not true for my Windows sandbox env. > > I am just hoping to fix my PATH, and use WT easily. > > Thanks, > > Malhar > > Edit: > > ![image](https://user-images.githubusercontent.com/16190134/72495049-b5155c00-384b-11ea-8d9e-bec8960910b1.png) > > Windows sandbox > > ![image](https://user-images.githubusercontent.com/16190134/72495089-c8282c00-384b-11ea-8751-5a928116bf2a.png) > > My current env > > ![image](https://user-images.githubusercontent.com/16190134/72495152-e68e2780-384b-11ea-88b1-da89963d50be.png) > > my WT > > CMD and WSL work correctly in WT > > After updating my PATH with `%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\` at the top of the list, it seems to be working now > ![image](https://user-images.githubusercontent.com/16190134/72495693-6ec0fc80-384d-11ea-82ca-40c48b6e2d73.png) > My CMD can call PS now ! > > ![image](https://user-images.githubusercontent.com/16190134/72495720-86988080-384d-11ea-9e19-6e667d68d09d.png) > WT runs PS Have you tried this solution ?
Author
Owner

@zadjii-msft commented on GitHub (Feb 18, 2020):

@OnurGumus You've gotta provide us some information - this issue was closed because we asked the author for feedback and they didn't respond. What commandline are you trying to run in the Terminal, and is that application on the PATH?

@zadjii-msft commented on GitHub (Feb 18, 2020): @OnurGumus You've gotta provide us some information - this issue was closed because we asked the author for feedback and they didn't respond. What commandline are you trying to run in the Terminal, and is that application on the `PATH`?
Author
Owner

@jrv912 commented on GitHub (Feb 18, 2020):

I've added this to both my User and System Environment Variables (At the top line) and am still getting this same error when trying to launch Powershell from cmd

wt -d c:\scripts "Windows PowerShell"

from cmd prompt, results in

wt -d c:\scripts "Windows PowerShell"

@jrv912 commented on GitHub (Feb 18, 2020): I've added this to both my User and System Environment Variables (At the top line) and am still getting this same error when trying to launch Powershell from cmd `wt -d c:\scripts "Windows PowerShell"` from cmd prompt, results in `wt -d c:\scripts "Windows PowerShell"`
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 18, 2020):

“Windows Powershell” is the name of a profile, not an executable, so you must put -p before it.

@DHowett-MSFT commented on GitHub (Feb 18, 2020): “Windows Powershell” is the name of a profile, not an executable, so you must put `-p` before it.
Author
Owner

@rafamerlin commented on GitHub (May 28, 2020):

So, I'm having the same issue with all terminals WT has available to me:
[error 0xd0000022 when launching 'powershell.exe']

[error 0xd0000022 when launching 'cmd.exe']

[error 0xd0000022 when launching 'wsl.exe -d Ubuntu']

[error 0xd0000022 when launching 'C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.0.1401.0_x64__8wekyb3d8bbwe\TerminalAzBridge.exe']

Is it possible that my PATH is broken for everything? Powershell, Cmd and Ubuntu's Terminal work fine for me from outside WT

Moved my powershell line to the top of Path but no success.

@rafamerlin commented on GitHub (May 28, 2020): So, I'm having the same issue with all terminals WT has available to me: `[error 0xd0000022 when launching 'powershell.exe']` `[error 0xd0000022 when launching 'cmd.exe']` `[error 0xd0000022 when launching 'wsl.exe -d Ubuntu']` `[error 0xd0000022 when launching 'C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.0.1401.0_x64__8wekyb3d8bbwe\TerminalAzBridge.exe']` Is it possible that my PATH is broken for everything? Powershell, Cmd and Ubuntu's Terminal work fine for me from outside WT Moved my powershell line to the top of Path but no success.
Author
Owner

@DHowett commented on GitHub (May 28, 2020):

So, the last report we got of 0xd0000022 was https://github.com/microsoft/terminal/issues/5488. Do any of the considerations in there apply to you?

@DHowett commented on GitHub (May 28, 2020): So, the last report we got of 0xd0000022 was https://github.com/microsoft/terminal/issues/5488. Do any of the considerations in there apply to you?
Author
Owner

@Teraskull commented on GitHub (May 31, 2020):

I also have this issue

[error 0x80070002 when launching `cmd.exe']

@Teraskull commented on GitHub (May 31, 2020): I also have this issue ```[error 0x80070002 when launching `cmd.exe']```
Author
Owner

@rafamerlin commented on GitHub (Jun 2, 2020):

@DHowett I tried to check the shortcuts from startmenu and none of the apps have the run as administration option enabled.

If I run WT as admin it works fine though. I tried another terminal called Hyper (written in Electron) and it won't even open if I don't run as Admin. I checked their issues on github and there's an fairly active topic about a bunch of people having the same issue.

Is there an exact location where I can check if these apps are running as admin? I would love to be able to use the wt anywhere by just typing wt (if I was in another terminal or something like that) but because I can't force it to run as Admin it won't work :(

@rafamerlin commented on GitHub (Jun 2, 2020): @DHowett I tried to check the shortcuts from startmenu and none of the apps have the run as administration option enabled. If I run WT as admin it works fine though. I tried another terminal called Hyper (written in Electron) and it won't even open if I don't run as Admin. I checked their issues on github and there's an fairly active topic about a bunch of people having the same issue. Is there an exact location where I can check if these apps are running as admin? I would love to be able to use the `wt` anywhere by just typing wt (if I was in another terminal or something like that) but because I can't force it to run as Admin it won't work :(
Author
Owner

@Nf-Jza commented on GitHub (Jun 6, 2020):

i have the same problem when trying to install link-preview,

C:\Users\User>wt install link-preview

and then it goes :

[error 0x80070002 when launching 'install link-preview']

@Nf-Jza commented on GitHub (Jun 6, 2020): i have the same problem when trying to install link-preview, `C:\Users\User>wt install link-preview` and then it goes : `[error 0x80070002 when launching 'install link-preview']`
Author
Owner

@DHowett commented on GitHub (Jun 6, 2020):

link-preview

Sorry about that. We don’t actually have extensions or the “wt install” command right now. We are tracking that in #4000

@DHowett commented on GitHub (Jun 6, 2020): > link-preview Sorry about that. We don’t actually have extensions or the “wt install” command right now. We are tracking that in #4000
Author
Owner

@MiXaiLL76 commented on GitHub (Jun 25, 2020):

link-preview

Sorry about that. We don’t actually have extensions or the “wt install” command right now. We are tracking that in #4000

https://youtu.be/8gw0rXPMMPE?t=27

But in the video you showed it!

@MiXaiLL76 commented on GitHub (Jun 25, 2020): > > > > link-preview > > Sorry about that. We don’t actually have extensions or the “wt install” command right now. We are tracking that in #4000 https://youtu.be/8gw0rXPMMPE?t=27 But in the video you showed it!
Author
Owner

@DHowett commented on GitHub (Jun 25, 2020):

The video also shows a terminal that is literally made of glass and floating in space. Some of the things in there are planned, some of them are stylistic. The link preview you're looking for is being tracked in #4000.

@DHowett commented on GitHub (Jun 25, 2020): The video also shows a terminal that is _literally made of glass_ and _floating in space_. Some of the things in there are planned, some of them are stylistic. The link preview you're looking for is being tracked in #4000.
Author
Owner

@kbrilla commented on GitHub (Jul 7, 2020):

guys I found solution!
basicly go to C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.0.1811.0_x64__8wekyb3d8bbwe //or wherever You app is instaled

copy the content to another folder, somewhere where You definitely have access to modify, i used new folder on my desktop

last step run WindowsTerminal.exe from that folder as admin.

image

@kbrilla commented on GitHub (Jul 7, 2020): guys I found solution! basicly go to C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.0.1811.0_x64__8wekyb3d8bbwe //or wherever You app is instaled copy the content to another folder, somewhere where You definitely have access to modify, i used new folder on my desktop last step run WindowsTerminal.exe from that folder as admin. ![image](https://user-images.githubusercontent.com/22288449/86794442-d3c31580-c06c-11ea-9b61-f76fa19e6385.png)
Author
Owner

@SaprativRay commented on GitHub (Jul 12, 2020):

I have installed Windows PowerShell 7 and in my settings.json file, I have included:

{
  "guid": "{fb0ad4d6-a0de-48b8-8feb-14df8467ad31}",
  "hidden": false,
  "name": "Windows PowerShell 7",
  "commandline": "pwsh.exe"
}

Now when I am starting this profile, it says:
[error 0x80070002 when launching pwsh.exe']`

@SaprativRay commented on GitHub (Jul 12, 2020): I have installed Windows PowerShell 7 and in my settings.json file, I have included: ``` { "guid": "{fb0ad4d6-a0de-48b8-8feb-14df8467ad31}", "hidden": false, "name": "Windows PowerShell 7", "commandline": "pwsh.exe" } ``` Now when I am starting this profile, it says: `[error 0x80070002 when launching `pwsh.exe']`
Author
Owner

@Limyx826 commented on GitHub (Aug 6, 2020):

We need to reopen this issue.
I'm going to open new issue hoping able to merge back.

@Limyx826 commented on GitHub (Aug 6, 2020): We need to reopen this issue. I'm going to open new issue hoping able to merge back.
Author
Owner

@zadjii-msft commented on GitHub (Aug 6, 2020):

@Limyx826 Please make sure to look through existing issues for a duplicate before filing a new issue. Thanks!

@zadjii-msft commented on GitHub (Aug 6, 2020): @Limyx826 Please make sure to look through [existing issues](https://github.com/microsoft/terminal/issues?q=is%3Aissue+0x80070002+is%3Aclosed) for a duplicate before filing a new issue. Thanks!
Author
Owner

@Limyx826 commented on GitHub (Aug 6, 2020):

@Limyx826 Please make sure to look through existing issues for a duplicate before filing a new issue. Thanks!

@zadjii-msft This thread is the issue

@Limyx826 commented on GitHub (Aug 6, 2020): > @Limyx826 Please make sure to look through [existing issues](https://github.com/microsoft/terminal/issues?q=is%3Aissue+0x80070002+is%3Aclosed) for a duplicate before filing a new issue. Thanks! @zadjii-msft This thread is the issue
Author
Owner

@Limyx826 commented on GitHub (Aug 6, 2020):

Windows build number: Microsoft Windows [Version 10.0.18363.959]
Windows Terminal version: 1.1.2021.0

For some reason Windows PowerShell path is broken. When I tried to open PowerShell, it will shown [error 0x80070002 when launching `powershell.exe'].

This issue doesn't occur one my pc is Windows 10 Version 10.0.19041.423 which I rolled back from.

image

@Limyx826 commented on GitHub (Aug 6, 2020): Windows build number: Microsoft Windows [Version 10.0.18363.959] Windows Terminal version: 1.1.2021.0 For some reason Windows PowerShell path is broken. When I tried to open PowerShell, it will shown [error 0x80070002 when launching `powershell.exe']. This issue doesn't occur one my pc is Windows 10 Version 10.0.19041.423 which I rolled back from. ![image](https://user-images.githubusercontent.com/38696851/89562098-0a4aa680-d84c-11ea-9596-083c7c3ca4cd.png)
Author
Owner

@DHowett commented on GitHub (Aug 6, 2020):

Edit your settings and delete the line that says “commandline: powershell.exe”.

@DHowett commented on GitHub (Aug 6, 2020): Edit your settings and delete the line that says “commandline: powershell.exe”.
Author
Owner

@DHowett commented on GitHub (Aug 6, 2020):

You will want to check your system PATH, because it no longer has PowerShell on it. That is going to break a few things, not just terminal. At least by removing this config option from Terminal you’ll be able to use it.

@DHowett commented on GitHub (Aug 6, 2020): You will want to check your system PATH, because it no longer has PowerShell on it. That is going to break a few things, not just terminal. At least by removing this config option from Terminal you’ll be able to use it.
Author
Owner

@Limyx826 commented on GitHub (Aug 6, 2020):

Edit your settings and delete the line that says “commandline: powershell.exe”.

Well this worked, thanks.

@Limyx826 commented on GitHub (Aug 6, 2020): > Edit your settings and delete the line that says “commandline: powershell.exe”. Well this worked, thanks.
Author
Owner

@thargy commented on GitHub (Sep 7, 2020):

In case this helps someone else.

Installing a preview version of Powershell 7 places the following in the PATH:
C:\Program Files\PowerShell\7-preview\preview

Which contains pwsh-preview.cmd not pwsh.exe. So pwsh or pwsh.exe will not work.

Change this to C:\Program Files\PowerShell\7-preview\ and it works fine.

@thargy commented on GitHub (Sep 7, 2020): In case this helps someone else. Installing a preview version of Powershell 7 places the following in the PATH: `C:\Program Files\PowerShell\7-preview\preview` Which contains `pwsh-preview.cmd` not `pwsh.exe`. So `pwsh` or `pwsh.exe` will not work. Change this to `C:\Program Files\PowerShell\7-preview\` and it works fine.
Author
Owner

@notexactlynikhil commented on GitHub (Nov 7, 2020):

PLEASE READ THIS. Alright so after some research I realised that the problem is with the environment variable. Open Environmental Variables and under System Variables, click on "PATH" and then click new. Now add this - %SystemRoot%system32
Click exit, now restart your System. Everything should be working perfectly fine now. Glad I could help!

@notexactlynikhil commented on GitHub (Nov 7, 2020): PLEASE READ THIS. Alright so after some research I realised that the problem is with the environment variable. Open Environmental Variables and under System Variables, click on "PATH" and then click new. Now add this - %SystemRoot%system32 Click exit, now restart your System. Everything should be working perfectly fine now. Glad I could help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#5931