Run a command on Windows startup (not login!)

Solution 1:

If you need to set the startup script programatically, you can use Scheduled Tasks:

schtasks.exe /create /tn "Task Name" /ru SYSTEM /Sc ONSTART /tr
"C:\command2run.cmd"

To run the task with elevated permissions (Vista and later), add the parameter /RL HIGHEST

Solution 2:

Define a startup script with your desired BAT file. Do this either via Local Computer Policy (for standalone machines) or via GPO (if in a domain.)


Solution 3:

Use Group Policy to run a Computer Startup script - this will run when the machine starts up without needing someone to login