vote up 1 vote down star

Wondering if there is some trick to scheduling a batch file to run in Vista.

I have tried almost every setting/arg I can think of with no result other than an error, or the command window opening then instantly closing without executing the code.

The batch files works fine when I double click to run.

flag

2 Answers

vote up 1 vote down

Does the task scheduler in control panel not work?

You can also use at from the command line. If you want your script to be interactive and be visible to the user, you can use the /interactive switch:

at 20:00 /interactive c:\path\to\somefile.bat

this will open the command prompt at 8pm.

For finer control over the scheduling you can use schtasks:

SCHTASKS /Create /SC MONTHLY /MO first /D SUN /TN game /TR c:\windows\system32\freecell
link|flag
yes, the default task scheduler does not work. using schtasks, I still get the same issue, where the command prompt simply opens then closes without executing the batch commands. – ArmoredCAvalry Nov 9 at 23:45
what about at ? – John T Nov 9 at 23:59
vote up 1 vote down

I figured out the issue.

If you have a batch file you want to run, the path to the batch file can not have any spaces in it (even if you include quotes).

Putting the batch file in C:\ allowed it to run via Task Scheduler.

link|flag
Sounds weird. I know the scheduler dialog is rather stupid like you should include quotes in the script path (browse:able) but exclude the quotes for the "start in" field... – Oskar Duveborn Dec 30 at 4:41

Your Answer

Get an OpenID
or
never shown

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