Try uninstalling/reinstalling the latest PWSH 7.3 version.
Naturally, you can't remove 5.1.
Please upvote and accept this thread as answered if it's helpful, thanks!
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I recently upgrade to Windows 11 from 10, but I don't know if that is related to the current. I started having the problem of PowerShell not finding programs when not supplied with the full path. For instance, ping works with no path from a CMD prompt, but does not from a PowerShell prompt. I get the error:
ping: The term 'ping' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
That sent me down the path of looking at the environment PATH when I discovered duplications. I've seen posts about cleaning duplicates out by editing through the GUI, or directly in the registry, but neither of those paths display the duplicates. The output from a CMD prompt from ECHO %PATH% follows. I split the string across multiple lines after the ; separator to make it easier to read. Where a line begins with a semicolon it's because there were two semicolons in the string.
C:\WINDOWS\System32;
D:\Program Files\Python\Python39\Scripts;
C:\Windows\System32\OpenSSH;
C:\Program Files\dotnet\;
;D:\Program Files\Python\Python39\Scripts;
C:\Windows\System32\OpenSSH;
C:\Program Files\dotnet\;
;D:\Program Files\Python\Python39\Scripts;
C:\Windows\System32\OpenSSH;
C:\Program Files\dotnet\;
C:\Users\byron\AppData\Local\Microsoft\WindowsApps;
C:\Program Files\Azure Data Studio\bin;
D:\Programs\Microsoft VS Code\bin;
C:\Program Files\JetBrains\PyCharm Community Edition 2022.2.3\bin;;
As you can see, there are path duplicated.
The path values from the registry are:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
%PATH%;D:\Program Files\Python\Python39\Scripts;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet\;
Computer\HKEY_CURRENT_USER\Environment
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Azure Data Studio\bin;D:\Programs\Microsoft VS Code\bin;%PyCharm Community Edition%;
I checked the path values through the Windows GUI as a sanity check and they correspond with the values from the registry as expected.
From PowerShell, $env:Path results in:
C:\Program Files\PowerShell\7;%PATH%;D:\Program Files\Python\Python39\Scripts;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet\;C:\Users\byron\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Azure Data Studio\bin;D:\Programs\Microsoft VS Code\bin;C:\Program Files\JetBrains\PyCharm Community Edition 2022.2.3\bin;;
Is there somewhere else the paths can get pulled from, or is this a known issue? I'd also like to know why PowerShell is displaying a different path, but I have not gone far looking for that yet.
Try uninstalling/reinstalling the latest PWSH 7.3 version.
Naturally, you can't remove 5.1.
Please upvote and accept this thread as answered if it's helpful, thanks!
I noticed in my Win11 upgraded from win10, that some system (OS) paths were included twice in the path, once "plain" and once through variable expansion.For example the windows directory was included as "C:\Windows", and a second time as "%systemroot%"; the system32 directory as "C:\Windows\System32" and as "%systemroot%\system32", the wbem directory as "C:\Windows\System32\wbem" and as "%systemroot%\system32\wbem".
All of them appeared twice in the cmd.exe path.
I guess this could be caused by different default ways to include them in 10 versus 11, while upgrading from 10 to 11 could be adding the new "default" values without deleting the old.