Python子进程命令没有被执行

时间:2016-03-11 11:00:26

标签: python subprocess

import subprocess

    try:
        command  = ['runas.exe','/user:Administrator','"bcdedit','/default','{78dj43af-9158-11e4-a25d-961c55rdf2df}"']
        print(str(command))
        prog = subprocess.Popen(command,stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        prog.communicate('123456')#Password for admin
        exitCode = prog.returncode
        print('Exit Code:-'+str(exitCode))

    except Exception as e:
        print('Exception is:' +str(e))

我无法弄清楚,当前代码有什么问题。

有人可以告诉我我犯了哪些错误吗?

0 个答案:

没有答案