Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a batch file I would like to run every time my Windows 7 VM restarts. I have created the batch file (and it functions as expected) as C:\example.bat. I have also setup a task in Task Scheduler with a trigger on startup and an action "start C:\example.bat". Right now the batch file doesn't trigger on startup as it is supposed to. If I change the trigger to login, the batch file triggers as expected on login. What is going on?

share|improve this question
add comment

1 Answer

I already tested it here before, you should add a delay(45 to 60 seconds) when triggering a task on Windows startup.

When triggering by startup, the trigger loads the task before desktop is running(before all Windows dependencies been booted), what makes your script never run(specially when you must insert a password to open the desktop).

When triggering by logon, the task will be loaded after the desktop is completely loaded(when a user session is created, after system startup), that is the reason why it work under this condition.

share|improve this answer
    
I tried a delay of 4 minutes just to be safe and no dice. Does this mean a user must be logged on to trigger it? –  TheDog Aug 15 '12 at 19:15
    
If triggered on Logon yes, a user session must be loaded. But not on trigger on startup. –  Diogo Aug 15 '12 at 19:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.