我已经阅读并尝试了各种方法,但它就是不接受......我什至试图逃避空格以及试图在路径前添加额外的引号(转义引号)......
$cmd = 'powershell.exe'
$dir = 'C:\Program Files (x86)\W T F'
$inner = "-NoExit -Command cd $dir"
$arguments = "Start-Process powershell -ArgumentList '$inner' -Verb RunAs"
& $cmd $arguments
Run Code Online (Sandbox Code Playgroud)
它不断给我这个:
x86 : The term 'x86' 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:22
+ cd C:\Program Files (x86)\W T F …
Run Code Online (Sandbox Code Playgroud) powershell ×1