【发布时间】:2015-10-08 08:34:19
【问题描述】:
我正在尝试使用 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.
当我在该文件夹中尝试另一个程序时,它似乎可以工作...有什么我立即丢失的东西吗?
【问题讨论】:
-
“System32”在 32 位进程中被重定向到“SysWOW64”。在 Windows 7+ 中,您可以将真正的“System32”作为“SysNative”访问。
-
哦,谢谢,我只是通过在 C:\PsTools 重新安装它来解决它,但感谢您将来参考。
标签: python windows python-2.7 subprocess psexec