Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Does Windows have an alternative to cron jobs? I'd like to schedule a task to run every morning at 6.

EDIT: I want to do it on the command line for use in a batch script.

share|improve this question
    
The command line gives no more finer control than the GUI, it's just less clicky –  Jim B Jul 10 '09 at 1:43
    
less clicky is good, because i just found out that it needs to be in a batch script... –  George IV Jul 10 '09 at 3:25
    
Did you ever try the built-in at command? –  Skyhawk Mar 30 '12 at 8:48

7 Answers 7

Windows has "Scheduled Tasks", with which you can schedule scripts and programs to run. Microsoft KB

Using Scheduled Tasks To open Scheduled Tasks, click Start, click All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks.

To schedule a new task:

  1. Double-click Add Scheduled Task to start the Scheduled Task Wizard, and then click Next in the first dialog box.
  2. The next dialog box displays a list of programs that are installed on your computer, either as part of the Windows XP operating system, or as a result of software installation.

    Use one of the following procedures: * If the program that you want to run is listed, click the program, and then click Next. * If you want to run a program, script, or document that is not listed, click Browse, click the folder and file that you want to schedule, and then click Open.

  3. Type a name for the task, and then choose one of the following options: * Daily * Weekly * Monthly * One time only * When my computer starts (before a user logs on) * When I log on (only after the current user logs on)

  4. Click Next, specify the information about the day and time to run the task, and then click Next.

    Note that the information about the day and time to run the task vary depending on the selection that you made in the previous wizard dialog box. For example, if you chose Weekly, you must indicate the day of the week, the time, and if the task should run every week, every 2 weeks, every 3 weeks, and so on.

  5. Type the name and password of the user who is associated with this task. Make sure that you choose a user with sufficient permissions to run the program. By default, the wizard selects the name of the user who is currently logged on.
  6. Click Next, and then click Finish after you verify the choices that you have made.
share|improve this answer
    
I was typing a very similar but less detailed response when you posted this. Oh well, +1 =) –  DWilliams Jul 9 '09 at 23:58
    
Wow, +1 for effort. –  Andrew H Jul 10 '09 at 10:42

You might also like to look into the 'at' command, which I use fairly often.

http://www.ss64.com/nt/at.html :)

For example,

at 6:00 /EVERY:m,t,w,th,f,s,su run_job.cmd

Would perform 'run_job' every day at 6.

share|improve this answer
up vote 3 down vote accepted

SCHTASKS was what I was looking for; I found it. Thanks for the help!

share|improve this answer

You can always try cron.

I install Cygwin on most of my Windows boxen.

share|improve this answer

The command you are looking for is called at and it will allow you to create scheduled tasks via the command line, e.g.:

at 22:00 shutdown /r /t 30

at 6a /every:m,t,w,th,f,s,su cmd /c c:\cave\vampire.bat

share|improve this answer

Try the Windows Task Scheduler (AKA Scheduled Tasks). You'll find it in the Control Panel.

share|improve this answer

Use scheduled tasks Start -> All Programs -> Accessories -> System Tools -> Scheduled Tasks

It's not as powerful as cron, but it'll get the job done for you.

share|improve this answer

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.