我想powershell使用环境变量"PATH"来解析可执行文件.我敢肯定它应该可以做到这一点,但这就是我得到的.
PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1
PS C:\> ${ENV:PATH} = "C:\WINDOWS\System32\"
PS C:\> ls ${ENV:PATH}\cmd.exe
Directory: C:\WINDOWS\System32
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 22/08/2013 8:03 PM 355840 cmd.exe
PS C:\> & cmd.exe
& : The term 'cmd.exe' 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:3
+ & cmd.exe
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (cmd.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)
运行Get-Command -Type Application以查看PowerShell看到的有效可执行文件.
您可能会发现有关正在发生的事情的线索,例如所有列出的应用程序都有(或没有)某个扩展名,这可能表示PATHEXT环境变量存在问题.
| 归档时间: |
|
| 查看次数: |
1403 次 |
| 最近记录: |