try:
output = subprocess.Popen(["devcon","status","*"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) #useing comma "," not space " " in Popen[]. replace the key word "*" to what you want to search.
stdout, stderr = output.communicate()
print "output: \n", output
print "stdout: \n", stdout # output here if ok.
print "stderr: \n", stderr # output if no arg
except subprocess.CalledProcessError:
print('Exception handled')
我的方法并不完美,但这对我来说是一个很好的解决方案,仅供你参考。通过devcon.exe在WDK(Windows开发。。。Kit),我的代码如下。在
相关问题 更多 >
编程相关推荐