如何用psexec运行多个命令?

我需要运行一个命令来卸载我们某些工作站的最前沿,并且在格式化命令时遇到了一些问题。

这是需要发生的事情(在多个命令中)

xcopy \\serverpath\Installer.exe C:\Windows Install.exe /u /s Del C:\Windows\Install.exe

我在计算机列表中使用psexec,但仍然遇到错误。 这就是我的命令现在的样子。

 psexec @ComputerList.txt -u domain\administrator cmd /c (xcopy "\\NetworkPath\Forefront Software\Install.exe" "C:\Windows" && Install.exe /u /s && del C:\Windows\Install.exe) 

我认为path名称和引号中的空格正在搞乱…

编辑:

尝试用脚本运行它没有运气。 它看起来像scepinstall.exe只是挂在远程机器上。 我也尝试使用可以在C:\Windows\ccmsetup\

谢谢您的帮助

我不认为这些括号是有效的。 我认为cmd.exe/s开关应该保留第一个和最后一个之间的所有内容" 。这是否工作?

 psexec @ComputerList.txt -u domain\administrator cmd /s /c "xcopy "\\NetworkPath\Forefront Software\Install.exe" "C:\Windows" && Install.exe /u /s && del C:\Windows\Install.exe" 

我使用下面的简化命令进行了testing,并且工作(修改为/k所以我可以查看输出)。

 psexec \\remotemachine cmd /s /k "dir "c:\temp" && echo "hello"" 

得到它了。 安装程序不喜欢脚本中的硬编码path,

从更改

 C:\ccmsetup\scepinstall.exe /u /s %windir%\ccmsetup\scepinstall.exe /u /s