views:

61

answers:

1

Hi there
i wanted to run a .bat file in windows task schedualer, so i opened it, added a new task, browsed to the bat file, and... nothing happened. so i changed the timing to see if it'll run, and it didn't. next i right-clicked on the task and chose "run"- it didn't run. the file itself is only one line, basicly backups a folder to a another location. it runs fine when not in the schedualer.
what can be done?
thank you

A: 

You should not give batch file directly as a task. Instead you should use

"C:\Windows\system32\cmd.exe" /C <completepathtobatchfile> <argstobatchfileifany>

the complete path to cmd.exe may vary in your case depending on which drive you installed OS and which version you are using.

Aviator
ok then. what does the /C do, btw?thank you for your help
bks
/C will make cmd.exe to exit after executing the specified command. Here it is your batch file. Else, cmd.exe will not exit.
Aviator
it wont run.in "run" text field i wrote: cmd.exe /C k:\backup.bat in the "start in" i wrote: k:\and the task will not run.
bks
Try giving full path to cmd.exe.See this for step-by-step details.http://www.iopus.com/guides/winscheduler.htm
Aviator