Vous êtes sur la page 1sur 5

How to Create, Modify and Delete Scheduled Ta... https://www.howtogeek.com/51236/how-to-crea...

How to Create, Modify and Delete Scheduled Tasks


from the Command Line
by Jason Faulkner on October 4th, 2010

Windows XP/Server 2003 introduced us to the SchTasks command line tool which
usurped the At tool o�ered in Windows 2000. This tool o�ers the ability to control every
aspect of your Scheduled Tasks through calls to this command.

While the wizard Windows uses to help you graphically create Scheduled Tasks is very
good, the command line tool is ideal for situations such as:

Manipulate tasks in batch scripts.

Control and create tasks on networked machines without having to login to them.

Mass create/sync task across multiple machines.

Use in custom applications to communicate with the Task Scheduler instead of


having to make API calls.

As you can probably imagine, the SchTasks command has more options than we can
cover in this article so we are going to focus on showing some examples of common
task con�gurations and what the respective task looks like in the Task Scheduler.

Root Access, 1GB RAM for


Only $5/month. 7 Day
Money Back Guarantee.
Ad Linode

Learn more

Examples

Create ‘My Task’ to run C:RunMe.bat at 9 AM everyday:

SchTasks /Create /SC DAILY /TN “My Task” /TR “C:RunMe.bat”


/ST 09:00

Modify ‘My Task’ to run at 2 PM:

SchTasks /Change /TN “My Task” /ST 14:00

1 of 5 1/1/70, 5:02 AM
How to Create, Modify and Delete Scheduled Ta... https://www.howtogeek.com/51236/how-to-crea...

Create ‘My Task’ to run C:RunMe.bat on the �rst of every month:

SchTasks /Create /SC MONTHLY /D 1 /TN “My Task” /TR


“C:RunMe.bat” /ST 14:00

Create ‘My Task’ to run C:RunMe.bat every weekday at 2 PM:

SchTasks /Create /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN “My


Task” /TR “C:RunMe.bat” /ST 14:00

Delete the task named ‘My Task’:

SchTasks /Delete /TN “My Task”

Note: this will raise a warning which you will need to con�rm.

Bulk Creation

Like any other command line tool, you can include multiple instructions in a batch �le to
accomplish bulk creation (or deletion).

For example, this script:

SchTasks /Create /SC DAILY /TN “Backup Data” /TR


“C:Backup.bat” /ST 07:00
SchTasks /Create /SC WEEKLY /D MON /TN “Generate TPS Reports”
/TR “C:GenerateTPS.bat” /ST 09:00
SchTasks /Create /SC MONTHLY /D 1 /TN “Sync Database” /TR
“C:SyncDB.bat” /ST 05:00

Produces these tasks:

2 of 5 1/1/70, 5:02 AM
How to Create, Modify and Delete Scheduled Ta... https://www.howtogeek.com/51236/how-to-crea...

The ability to do this is a quick way to roll out new tasks or change existing schedules to
many machines at once. As a way to ensure the tasks are updated, you could include the
appropriate SchTasks commands in a domain login script which will update user
machines when they log in.

Microsoft Documentation on SchTasks Command

SHARE: COMMENTS:

Jason Faulkner is a developer and IT professional who never has a hot cup of
co�ee far away. Interact with him on Google+

DID YOU KNOW


The most common modern-day greeting in Korea is
“annyeonghaseyo” (or: “ ”) and translates
literally as “Are you safe?” (or “Are you all right?”)
—although the exact origin of the phrasing is
unknown, it is believed to have originated from
older times when sickness posed a more
immediate and signi�cant threat.

Best flight
deal - London
This monsoon season, get
the cheapest flights to
London only on MakeMyTrip.
makemytrip.com/flights

BEST OF HOW-TO GEEK


The Best Ways to Automatically Back Up the

3 of 5 1/1/70, 5:02 AM
How to Create, Modify and Delete Scheduled Ta... https://www.howtogeek.com/51236/how-to-crea...

Photos on Your Smartphone

HDTV Overscan: What It Is and Why


You Should (Probably) Turn It O�

7 Ways To Free Up Disk Space on Mac


OS X

10 Quick Ways to Speed Up a Slow


Mac

How to Use a USB Key to Unlock a


BitLocker-Encrypted PC

Streaming Box Showdown: Apple TV


vs. Roku vs. Amazon Fire TV vs.
Chromecast vs. Android TV

How to Control the Windows Desktop


With an Xbox or Steam Controller

10 Quick Ways to Speed Up a Slow PC


Running Windows 7, 8, or 10

How to Send and Receive Faxes


Online Without a Fax Machine or
Phone Line

7 Of The Best Turn-Based Multiplayer


Games For Mobile

US Visa
$500,000
Required

USCIS Requires
$500,000.
Thousands Of
Successful
Clients From
All Over The
World.

GET THE HTG NEWSLETTER


Join 100,000 other subscribers

Enter Your Email Here

Go

FOLLOW HOW-TO GEEK

4 of 5 1/1/70, 5:02 AM
How to Create, Modify and Delete Scheduled Ta... https://www.howtogeek.com/51236/how-to-crea...

160K+ 50K+ 90K+

MORE ARTICLES YOU MIGHT LIKE

Improve English Speaking How to Create the Ultimate PCB Fab and Assembly How To Personalize the
USB Key Ring to Solve Windows Command
Any Computer Problem Prompt
Ad eAgeTutor howtogeek.com Ad PCBA Store howtogeek.com

IIIT-H AI/ML Program Electronic Parts Supplier How to Write a Batch How to Run Command
Script on Windows Prompt Commands from a
Windows Shortcut
Ad TalentSprint Ad OUGE Electronic howtogeek.com howtogeek.com

ABOUT GET ARTICLES BY EMAIL FOLLOW US


About Us
Enter your email address to get our daily newsletter.
Contact Us TWITTER GOOGLE+
Write For Us
Discussion Forum Enter Your Email Here GET ARTICLES BY EMAIL FACEBOOK RSS FEED
Review Geek
Advertising
Privacy Policy
Terms of Use

Disclaimer: Most of the pages on the internet include a�liate links, including some on this site.

Copyright © 2006-2018 How-To Geek, LLC  All Rights Reserved

5 of 5 1/1/70, 5:02 AM

Vous aimerez peut-être aussi