subprocess.Popen不适用于reg query命令

时间:2017-09-06 06:33:04

标签: python subprocess registry

当我尝试在python中查询注册表值(REG QUERY HKU / v“VBAWarnings”/ s)popen()时,我得到0个匹配

import subprocess
command = 'REG QUERY HKU /v "VBAWarnings" /s'
output,error = subprocess.Popen(command,universal_newlines=True,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()

如果我打印输出,则输出为0匹配

print output

End of search: 0 match(es) found.

但是同一命令在命令提示符

上执行时给出了匹配

输出:

HKEY_USERS\S-1-5-21-2149410145-3230408028-977776915-
500\Software\Microsoft\Office\12.0\Word\Security

    VBAWarnings    REG_DWORD    0x1

End of search: 1 match(es) found.

0 个答案:

没有答案