【发布时间】:2020-10-25 04:08:54
【问题描述】:
我有一个脚本应该使用不同的凭据运行 powershell,然后在该会话中应该转到网络路径并安装文件:
$path1 = "\\192.168.10.10\bucket\test.exe"
Start-Process powershell -Credential $creds -ArgumentList "-Command &{Start-Process $path1 -Verb RunAs}"
从 ISE 运行它看起来没有问题,但是当我保存 ps 文件并尝试从批处理文件中调用它时,我收到以下错误:
这可能是什么原因?
【问题讨论】:
-
powershell.exe或%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe。你如何从批处理中调用Start-Process?powershell -command?
标签: windows powershell networking path