Newbie question: getting my program to run at startup on Windows
Miki Tebeka
miki.tebeka at zoran.com
Wed Feb 11 00:43:05 EST 2004
Hello Arjan,
> key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
> "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
>
> _winreg.SetValueEx(key, "earthclock", 0, _winreg.REG_SZ, os.getcwdu() +
> "\\EarthClock.exe")
> _winreg.CloseKey(key)
>
> But I get "WindowsError: [Errno 5] Access is denied"
>
> I'm probably doing something blatantly wrong. Does anyone know what it
> is?
As the docs say, the default access mask for OpenKey is KEY_READ. Try:
key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
sam=_winreg.KEY_ALL_ACCESS)
HTH.
Miki
More information about the Python-list
mailing list