Answer the question
In order to leave comments, you need to log in
Why is it impossible to add a file to autorun through the registry?
I have code
import winreg
KEY = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', winreg.KEY_SET_VALUE)
winreg.SetValueEx(KEY, 'NEWNAME', 0, winreg.REG_NONE, r'C:\Users\Username\Desktop\REG.py')
key.Close()
Answer the question
In order to leave comments, you need to log in
Objects of type 'str' can not be used as binary registry valuesto the translator
winreg.REG_SZ
KEY = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 0, winreg.KEY_SET_VALUE)
KEY = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', access=winreg.KEY_SET_VALUE)
winreg.KEY_SET_VALUE
must be set for the access
. The method itself looks like this:winreg.OpenKey(key, sub_key, reserved=0, access=KEY_READ)
winreg.KEY_SET_VALUE
passed in the parameterreserved
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question