【发布时间】:2016-03-15 20:27:32
【问题描述】:
我正在努力在 PS 脚本中使用 Psexec 来执行交互式程序。 我试过这个:
PsExec.exe -i \\192.168.100.95 -u Administrador -p Test1234 cmd /c "echo . | powershell notepad" 2> $null
... 它运行得非常好。记事本在远程机器上启动。现在,当我想从 Program Files (x86) 运行 .exe 时,我一无所获。 我已经尝试过这种变体来运行位于 ProgramFiles(x86) 中的 1.exe:
PsExec.exe -i \\192.168.100.95 -u Administrador -p Test1234 cmd /c "echo . | powershell "${env:ProgramFiles(x86)}\1.exe"" 2> $null
PsExec.exe -i \\192.168.100.95 -u Administrador -p Test1234 cmd /c "echo . | powershell "${env:ProgramFiles(x86)}" + "\1.exe"" 2> $null
但是它们都不起作用。知道有什么问题吗?
【问题讨论】:
标签: powershell escaping quoting