Running bat file using Windows scheduler
8,742
I find it easier to just use the at
command.
For example to run the batch file located at: C:\script.bat
at 4 AM every Tuesday you would do the following in a command-prompt:
at 4:00 /every:T "C:\script.bat"
Related videos on Youtube
Author by
bks
Updated on September 17, 2022Comments
-
bks over 1 year
I wanted to run a .bat file in Windows task scheduler, 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 scheduler.
When I asked on stackoverflow.com they first said to come here and the other guy said to write:
cmd.exe /C completepathtobatchfile argstobatchfileifany
So I wrote:
cmd.exe /C k:\backup.bat
and it didn't work. What do I have to change to make it work?
-
UNK over 14 yearsEven in XP, any batch file in a path on your PATH should be found.
-
MDMarra over 14 yearsT is for Tuesday
-
Ben S over 14 yearsYes, and Th is for Thursday.
-
bks over 14 yearswhat about doing that every day? or two days for that matter?
-
CarlF over 14 yearsI was referring to using full paths INSIDE the batch file, not necessarily the path TO the batch file.