How to run an .exe on boot and keep it running regardless of who logs in on Windows?

How would one go about causing an .exe to run when a Windows system boots, and leave the .exe running regardless of who is logged in? Is this possible?


As per this Sysinternals forum post, the most reliable way to do so is to add a scheduled task. Simply define a trigger At startup. It will keep running until it is forcibly terminated, e.g. by a crash or the user killing the process. A standard/limited user can't see or kill processes they do not own.

Screenshot of scheduled task trigger
Click for full size

You also have to set the task to Run whether user is logged on or not, and probably should run as an Administrator account, with highest privileges. You can even run as the SYSTEM account.

Screenshot of scheduled task user
Click for full size

This is distinct from the At logon trigger.

If you wanted to do this programatically (i.e. make your program add itself to system startup), the best way would be to create a Windows service.