Home>

Is it possible pyinstaller -The turn file .py. at .exe And then to autorun or through the planner?

Do you definitely exe? And what if Bat, which will hang in autorun and in the scheduler?

Konstantin Fedorov2021-04-08 17:55:20

Yes, and Bat is superfluous. You can right so, with all the arguments.

GrAnd2021-04-07 18:20:20

It is possible, but why such difficulties?

Интик2021-04-07 18:21:16

The EXE program with the help of the code itself added to autoload (on Python)

Blex2021-04-07 20:31:35
  • Answer # 1

    Alternatively, you can check for the presence of just running script in the startup folder, and if it is not there -copy there.

    Import OS, SYS
    Thisfile= sys.argv [0] # full path to the file, including the name and expansion
    Thisfile_name= os.path.basename (thisfile) # file name without a way
    user_path= os.path.expanduser ('~') # path to user folder
    If not os.path.exists (F "{User_Path} \\ AppData \\ Roaming \\ Microsoft \\ Windows \\ Start Menu \\ Programs \\ Startup \\ {thisfile_name}"):
            OS.System (F'Copy "{thisfile}" "{User_Path} \\ AppData \\ Roaming \\ Microsoft \\ Windows \\ Start Menu \\ Programs \\ Startup" ')
            Print (f '{thisfile_name} added to autoload')
    

    But it will work only if you have a script compiled in .exe Otherwise, in addition to the script itself, you will need to create .bat or .cmd file in the starter of the startup or .cmd file that will already run the script.

    @echo off
    Python pythoncode.py.
    EXIT.