Using Windows 10, I can't run certain commands from PowerShell but they all work correctly using cmd.
PowerShell:
node --version:
node : The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ node --version
+ ~~~~
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
node.exe --version: no output.
node.exe: opens a new black console (node.exe application itself).
Get-Host | Select-Object Version:
Version
-------
5.1.19041.906
Get-Command node: The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-Command node + ~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (node:String) [Get-Command], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
Get-Command node.exe: CommandType Name Version Source ----------- ---- ------- ------ Application node.exe 14.16.1.0 C:\Program Files\nodejs\node.exe
$env:Path output has nodejs & git & other paths.
cmd:
everything works fine with any command.
I have git and nodejs in my PATH env variable.
What's wrong with PowerShell, what a strange behavior is this and how to fix it?
$env:Path -split ';' | Sort-Object
to see if the path in that session is what is needed. please remember that the path will also vary per account AND powershell host ... so make sure to test in the exact same setup that your current failure shows up in.executable
in some way AND that matchesnode
. you may want to search for the unwanted item [perhapsnode.js
?] and either remove it OR rearrange your path sequence.node.exe
, a new window pops up? That’s not normal. How do you start Powershell? What about other programs likenotepad
orcmd
?