簡體   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