![]() |
run python file on background and start on windows boot - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: run python file on background and start on windows boot (/thread-7042.html) |
run python file on background and start on windows boot - dwiga - Dec-19-2017 I want to run my python file on background and start it when my windows boots, I have reference site from this https://stackoverflow.com/questions/31130960/run-a-program-at-start-up-on-python-in-windows, but I have no idea how to do with it. can you guys tell me how to get rid my problem? thanks in advance RE: run python file on background and start on windows boot - Venkatkrish - Dec-19-2017 Fyi .. https://stackoverflow.com/questions/4438020/how-to-start-a-python-file-while-windows-starts Useful tips: Find diff bet pythonw.exe and python.exe "If you don't want a terminal window to pop up when you run your program use pythonw.exe; Otherwise, use python.exe" RE: run python file on background and start on windows boot - buran - Dec-19-2017 couple of options 1. put a link to your python file in shell:startup folder (i.e. no need to use bat file, unless you want to)2. You can use Task Scheduler to set up a task that will start the script at login RE: run python file on background and start on windows boot - dwiga - Dec-22-2017 (Dec-19-2017, 06:33 AM)Venkatkrish Wrote: Fyi .. I have been browsing but I found nothing, how to use pythonw.exe to run my python file? note that I use python 3. (Dec-19-2017, 09:13 AM)buran Wrote: couple of options where is shell:startup ?
RE: run python file on background and start on windows boot - buran - Dec-22-2017 type it in the windows explorer address bar. or from start menu ->run->shell:startup RE: run python file on background and start on windows boot - dwiga - Dec-23-2017 (Dec-22-2017, 03:08 PM)buran Wrote: type it in the windows explorer address bar. OK, I've found it.. so, how to make a link into it or use a batch file? can I just copying my whole python file into it? I am sorry, I really new to this. RE: run python file on background and start on windows boot - cryomick - Jan-02-2018 A batch file is just a series of commands to be executed in the command line. If you have ever executed your script from the command prompt you already know all you need. Create a text file and write down the steps you would follow to execute your python script: 1. You change the directory to where the script is located. 2. run the script So your text file would look something like this: Quote:cd C:\\Users\\Location_of_scriptThen rename the text file with a '.bat' extension. Now put this file in the startup folder. Points to note: 1. Ensure that Python is added as an environment variable 2. Batch files are wonderful for a multitude of other things. Check it out! RE: run python file on background and start on windows boot - buran - Jan-02-2018 you can go with bat file, as suggested or you can just create a link (shortcut) Right-click -> New -> Shortcut In the window that opens, write (or browse to find) the path to your python.exe. That will be in the top folder where you have installed python. Add full path to your script. So it will look like c:\python3\python.exe c:\pathtoyourscript\yourscript.py on the next window name your shortcut whatever youlike |