Python Forum
Automatic registering python to registry
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic registering python to registry
#1
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
Reply
#2
Fixed
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Information automatic document renaming lisa_d 2 275 Mar-20-2024, 06:34 PM
Last Post: Pedroski55
Question How to add Python folder in Windows Registry ? Touktouk 1 207 Feb-20-2024, 01:04 PM
Last Post: DeaD_EyE
  Read complete windows registry? fredep57 3 903 Mar-15-2023, 08:14 PM
Last Post: buran
  Matplotlib - automatic update frohr 1 1,079 Mar-29-2022, 07:05 PM
Last Post: deanhystad
  automatic create folders Mr_Kool 4 1,718 Dec-21-2021, 04:38 PM
Last Post: BashBedlam
  Automatic user/password entry on prompt by bash script PBOX_XS4_2001 3 2,727 May-18-2021, 06:42 PM
Last Post: Skaperen
  How to add new registry key shlomi27 3 10,204 Feb-04-2021, 05:45 PM
Last Post: reidnax
  Automatic redefining Hassediagram 5 3,220 Feb-25-2019, 01:36 PM
Last Post: Hassediagram
  How to ignore - ERROR: The system was unable to find the specified registry key or va asheru93 9 6,550 Feb-04-2019, 06:35 AM
Last Post: asheru93
  Registry Key Access malonn 11 9,135 Jul-26-2018, 09:45 AM
Last Post: gontajones

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020