我正在尝试制作一个禁用cmd的脚本。这是我的脚本:
import winreg
registry_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "SoftwarePoliciesMicrosoftWindowsSystem", 0, winreg.KEY_WRITE)
winreg.SetValueEx(registry_key, "DisableCMD", 0, winreg.REG_DWORD, "1")
但我得到
Traceback (most recent call last):
File "C:Usersusernamewinregg.py", line 3, in <module>
winreg.SetValueEx(registry_key, "DisableCMD", 0, winreg.REG_DWORD, "1")
ValueError: Could not convert the data to the specified type.
我做错了什么,我该如何解决?
试试这个...
winreg.SetValueEx(registry_key, "DisableCMD", 0, winreg.REG_DWORD, 1)