[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 36038
  • Last Modified:

How to create a Windows Scheduled Task using script or command line

Hi,

I need to create a script or a .bat file to create a Windows Scheduled Task, however I need to specify in the script or the .bat file that this task should run every 30 mins.

I tried to use the AT command but I was unable to run the task more than once a day, however if I try to use the GUI interface, I can choose to run the task daily and then in the Advanced options I can choose repeat the task every 30 mins.

Thats why I believe its possible.

Thank you.
0
msghaleb
Asked:
msghaleb
  • 3
  • 2
1 Solution
 
oBdACommented:
It is possible in Windows XP or W2k3 using schtasks.exe:

How to use Schtasks.exe to Schedule Tasks in Windows Server 2003
http://support.microsoft.com/?kbid=814596

Schtasks
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true
0
 
msghalebAuthor Commented:
Well, that's near the point, but I was looking to do a script so that I can run it on Windows 2000 and 2003 also I don't want to put any passwords or put it once in the script as other wise I'll still have to do it one by one.

Thank you.
0
 
msghalebAuthor Commented:
Ok the password point is working as the tool support it, I'll give it a try on Windows 2000, if it works will let you know.

thanks alot so far :)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
msghalebAuthor Commented:
Worked thanks :)

Just for the ref. here how it can work on Windows 2000

http://makemsi-manual.dennisbareis.com/schtasks_exe.htm 
http://www.windowsitpro.com/Article/ArticleID/25186/25186.html

Thanks again

MG
0
 
oBdACommented:
Haven't worked with it, but there's a native Resource Kit tool for Windows 2000 as well, jt.exe.
This article includes the syntax and a download link:
2621 » Microsoft ® Task Scheduler Command Line Utility. 20-Jul-00
http://www.jsifaq.com/SF/Tips/Tip.aspx?id=2621
0
 
Jim P.Commented:
This works on Windows 2003 and XP from the command prompt or Run window. Note that there are other options. Do a SCHTASKS /Create /? to get the full list.

-------------------------------------------------------------------
SCHTASKS /Create /RU UserID /RP Password /SC ONCE /TN Reboot /TR "C:\WINDOWS\system32\shutdown.exe /r /t 015 /f /d P:02:04?" /SD 02/20/2010 /ST 01:50:00
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now