0
我想更改註冊表的值。我嘗試了以下,但它不起作用。我不知道我的代碼中存在什麼問題!在Python中使用註冊表
KeyVal = r'SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy Objects\{B3D42F82-AE5B-4AE1-939C-E958D13732D2}Machine\Software\Policies\Microsoft\Windows\RemovableStorageDevices\{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}\Deny_Execute'
try:
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,KeyVal,0, winreg.KEY_ALL_ACCESS)
key = winreg.CreateKey(winreg.HKEY_CURRENT_USER,KeyVal)
winreg.SetValueEx(key,"Deny_Execute",0,winreg.REG_DWORD,0)
winreg.CloseKey(key)
except:
pass