Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我想要运行的字符串中有应用程序的路径。例如:[io.path]::Combine($path, $filename)它被解释为C:\foo\baa.exe。我尝试过使用&$path运算符,但使用变量不起作用。
[io.path]::Combine($path, $filename)
C:\foo\baa.exe
&$path
我刚拥有& $path(注意空间)和Invoke-Item $path工作。
& $path
Invoke-Item $path
就像是:
$path = "C:\Windows\System32\notepad.exe" &$path
应该管用。确保您正确设置路径。后面不需要空格&。
&