使用 Windows 10,我无法从 PowerShell 运行某些命令,但它们都可以使用 cmd 正常运行。
电源外壳:
节点-版本:
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 --版本:无输出。
节点:打开一个新的黑色控制台(node.exe应用程序本身)。
获取主机 | 选择对象版本:
Version
-------
5.1.19041.906
Get-Command 节点: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
获取命令 node.exe:CommandType Name Version Source ----------- ---- ------- ------ Application node.exe 14.16.1.0 C:\Program Files\nodejs\node.exe
$环境变量:Path输出有nodejs&git&其他路径。
命令:
使用任何命令,一切正常。
我的 PATH 环境变量中有 git 和 nodejs。
PowerShell 出了什么问题,这是一种什么奇怪的行为以及如何修复它?