繁体   English   中英

不能与psexec.exe一起使用subprocess.call

[英]Cannot use subprocess.call with psexec.exe

我试图使用psexec在远程PC上运行脚本,但是当我使用subprocess.call时,我得到WindowsError: [Error 2] The system cannot find the file specified

我已经下载了PsExec,将其解压缩并将所有内容放入其中

C:\\Windows\\System32\\ ,我的测试代码是:

from subprocess import call

call(['C:\\Windows\\System32\\PsExec.exe'])

我只是想看看我是否能看到命令正常运行,但是没有运气。

当我尝试call(['C:\\\\Windows\\\\System32\\\\PsExec.exe'], shell=True)我得到

'C:\\Windows\\System32\\PsExec.exe' is not recognized as an internal or external command, operable program or batch file.

当我在该文件夹中尝试另一个程序时,它似乎可以正常工作...我马上缺少什么吗?

您可以尝试以下方法:

from subprocess import call

call(['C:\\Windows\\SysNative\\PsExec.exe'],shell=True)

我希望它可以在您的系统上工作!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM