Search code examples
pythonwindows-10startup

Starting a python file when a computer starts


I am trying to run a python file when my Windows 10 computer starts up. I've already coded the file. It asks for a password and if its incorrect, it shutdown the computer. If the password is correct, it ends the file and lets the user to continue.

I've looked around but all i can see is how to do it with batch files or solutions to do it when a user logged in, im the only one that uses my machine and there is only 1 user

I've heard something about searching for a 'startup' folder but cant find it. Any ideas?

P.s if you know how to get to the start up folder that could help as well


Solution

  • Place your python file in the Startup folder. The folder is located at

    C:\Users\<user-name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
    

    Make sure you have enabled Show hidden files. The AppData folder is a hidden folder so you won't find it if you don't enable it.