Python Forum

Full Version: Automatic registering python to registry
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I successfully registered python to the registry, but when I convert it into exe, data registers as python script instead of exe.
I am creating a script that will take the file name and file directory and register it to startup, but I am unable to do with exe.
Has anyone done this before?

Here's the code:

import winreg
import os

os.path.dirname(os.path.abspath(__file__))
os.path.realpath(__file__)

key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 0, winreg.KEY_SET_VALUE)
winreg.SetValueEx(key, __file__, 0, winreg.REG_SZ, __file__)
key.Close()
winreg.SetValueEx(key, __file__, 0, winreg.REG_SZ, __file__) <- first __file__ is name of file second __file__ is dir of file
Fixed