- 1 year ago
Python script autorun on windows startup
To make a Python script autorun on Windows startup, you can add an entry to the Windows Registry. Here's how you can do it:
Open the Windows "Run" dialog by pressing Win + R.
Type
regedit
and hit Enter to open the Registry Editor.Navigate to the following registry key:
mathematicaHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
Right-click on the "Run" key in the left pane, select "New," and then click "String Value."
Provide a name for the string value (e.g., "MyPythonScript").
Double-click on the newly created string value, and in the "Value data" field, enter the full path to your Python script preceded by
"pythonw"
(without the quotes). For example:luapythonw C:\path\to\your\script.py
Note: Using
pythonw
instead ofpython
as the command will run the script in the background without opening a console window.Click "OK" to save the changes.
After adding the entry to the Registry, the Python script will automatically run every time you start up your Windows system.
Please exercise caution when modifying the Windows Registry. Making incorrect changes to the registry can cause system instability or other issues. Make sure to back up the registry or create a system restore point before making any changes.