Realization Method of python Script Startup and Self startup

  • 2021-07-03 00:39:38
  • OfStack

Problem description: Set python script to boot and start.

Environment: windows7 64-bit

Some time ago, 1 straight want to package the file into exe file, Then set to boot and start, Although it feels pretentious, However, the process of using pyinstaller to package into exe file is very bumpy. 1 change the script or import a new library, and there will be various errors and problems in packaging. Finally, the blogger really gave up after finding a solution. Who knows, suddenly he saw a blog saying that he can directly set the py program to boot and start, which is really happy. The following operation steps are explained:

(1) First, you need to create a new. bat file (to run the script) in the following format, and the red part is the location of the python script (save it after writing):

python f:\project_cx\wanggong\httpRoute.py

pause

(2) Click Start-All Programs-Start-Right-Click-Open, and copy the saved. bat file to this directory (C:\ Users\ Administrator\ AppData\ Roaming\ Microsoft\ Windows\ Start Menu\ Programs\ Startup), which may be blocked by antivirus software. Select Allow, and then restart the computer.

Note: One cmd window will be opened after startup. If the window is closed, the python program will stop running.


Related articles: