Batch Script Not Running at Startup Using Windows Task Scheduler

Batch Script Not Running at Startup Using Windows Task Scheduler

I have written a simple batch script [E:\Project Artemis\startup.bat] to start Python SimpleHTTPServer at startup of Windows 7, with the script working when I manually execute it, but after adding it to Task Scheduler to launch at system startup, it does not do so (Task Scheduler shows the process ran and it's status as ready)

@ECHO OFF 
pushd E:\Project Artemis\Wave 
python -m http.server
  • When I try to run it from Task Scheduler manually, the script does not work and History shows the task was completed with return code 1, meaning something went wrong, but provides no details:
    • Directory Project Artemis contains multiple files and I added E:\Project Artemis\ to the task's Start in(optional) parameter

How do I troubleshoot this and is there another way to start Python SimpleHTTPServer at startup?

10

2 Answers

Answering my own question for future readers as per suggestion of @music2myear.

As it is visible in the screenshot, I had set the user as SYSTEM to give the task high privilege. But due to some reason this interfered with the ability of the task to run and I am not sure why. Even if I were to run it from task scheduler window, it would not work.

However after fiddling around, I found that if the User Account to run the task is NOT set to SYSTEM, the task runs perfectly.

For example:

1

You'll want to create an .exe that opens the .bat, then pin the .exe to the Startup menu.

1
Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.