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"
Share:
8,742

Related videos on Youtube

bks
Author by

bks

Updated on September 17, 2022

Comments

  • bks
    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
    UNK over 14 years
    Even in XP, any batch file in a path on your PATH should be found.
  • MDMarra
    MDMarra over 14 years
    T is for Tuesday
  • Ben S
    Ben S over 14 years
    Yes, and Th is for Thursday.
  • bks
    bks over 14 years
    what about doing that every day? or two days for that matter?
  • CarlF
    CarlF over 14 years
    I was referring to using full paths INSIDE the batch file, not necessarily the path TO the batch file.