import win32api
import win32con
key = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE,’SOFTWARE’,0,win32con.KEY_ALL_ACCESS)
error reporting pywintypes.error: (5, ‘RegOpenKeyEx’, ‘xbe\ xbe\xf8\xb7\xc3\ xca\xa1\xa3’)
then the positioning problem occurred in win32con.key_all_access, which was due to the willingness of the registry access to be denied, so the access permission needed to be increased, by the following methods:
the first method:
WIN7 has administrator privileges:
1. Right-click computer, go to administration, and find users and groups.
2. Find administrators, right-click to bring up the property, and remove the check mark before “this account is disabled”.
back to the desktop
3. Create a new “notepad” and copy as follows:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\runas]
@=” administrator takes ownership”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOT\*\shell\runas\command]
@=”cmd.exe /c takeown /f \”%1\” & & icacls \”%1\” /grant administrators:F”
“IsolatedCommand”=”cmd.exe /c takeown /f \”%1\” & & icacls \”%1\” /grant administrators:F”
[HKEY_CLASSES_ROOT\exefile\shell\runas2]
@=” administrator takes ownership”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOT\exefile\shell\runas2\command]
@=”cmd.exe /c takeown /f \”%1\” & & icacls \”%1\” /grant administrators:F”
“IsolatedCommand”=”cmd.exe /c takeown /f \”%1\” & & icacls \”%1\” /grant administrators:F”
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@=” administrator takes ownership”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@=”cmd.exe /c takeown /f \”%1\” /r /d y & & icacls \”%1\” /grant administrators:F /t”
“IsolatedCommand”=”cmd.exe /c takeown /f \”%1\” /r /d y & & icacls \”%1\” /grant administrators:F /t”
and then save as win7 to get administrator privileges. Reg, suffix must be.reg
imports the saved registry information, thus gaining WIN7 administrator rights.
right click on the folder and “administrator takes ownership” will appear
the second method:
ctrl+r
input lusrmgr. MSC
user — double-click administrator to uncheck the “account disabled” check
logout
select administrator account to log in