Hey guys,

I have a python script that I need to run on a windows machine when the computer boots up but before a user logs in. It is the server side of server/client program. The program needs to be able to write and read files, as the server program is somewhat of a database file/retrieval script. The script must be able to run without a user being logged in. Also, I will eventually be converting this to an exe file, if that matters. Can you do this in Python or is this more of a windows thing? If it is a windows thing, how do I get it to run as I want?

Thanks for the help!

Recommended Answers

All 5 Replies

For Windows, you may need to run the script in service space. Services are initialized once windows boots up and run until it shuts down. I don't know how you can run a python script as a service though, you can try bootstrapping.

hmm... I don't think a bootloader would be the best option for my project. The service option might work. Thanks for the help.

Still, does anyone have any other suggestions?

Running it as a service works great!!! thanks for the help

Running it as a service works great!!! thanks for the help

What did you do to get it running as a service?

Well, I found some example code at
http://code.activestate.com/recipes/551780/

This was a great example and works well.
All you have to do to get your script running is put your program code/function in the start function of the service class or the class you have built from the service class.
You can see the service running in the service manager (Found by typing 'Services.msc' the run box).
You can view the log by right clicking My Computer, selecting 'manage', and viewing the application logs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.