fortypoundhead.com

SCHTASKS

Posted On 2007-04-24 by FortyPoundHead
Keywords: Command Reference
Tags: Windows Commandline Windows
Views: 3392


Create, delete, edit, list, start or stop a scheduled task.
Works on local or remote computers.

Syntax:

SCHTASKS /Create create_options

SCHTASKS /Delete [/S system [/U username [/P password]]] /TN taskname [/F]

SCHTASKS /Query [/S system [/U username [/P password]]] [/FO format] [/NH] [/V]

SCHTASKS /Run [/S system [/U username [/P password]]] /TN taskname
SCHTASKS /End [/S system [/U username [/P password]]] /TN taskname

SCHTASKS /Change [/S system [/U username [/P password]]] {[/RU username] [/RP password] [/TR taskrun]} /TN taskname

create_options:
[/S system #remote system (default is local)
[/U username [/P password]]] #submit job under this name
[/RU username [/RP password]] #run job under this name
/SC schedule [/MO modifier] #When to run, see below
[/D day] #day = MON,TUE,WED,THU,FRI,SAT,SUN
[/M months] #month=JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC.
[/I idletime] #1 - 999 minutes (ONIDLE task only)
/TN taskname /TR taskrun #Name and pathname for task
/ST starttime #HH:MM:SS (24 hour)
[/SD startdate] [/ED enddate] # start and end date "dd/mm/yyyy"

query_del_options:
/F Force delete, ignore warnings even if the task is currently runnning.
/FO format Output format: TABLE, LIST, CSV
/NH No header
/V Verbose outputNotes:
For MONTHLY schedules give the DAY as a number 1 - 31 (default=1)

To prompt for the password, specify /RP * or /RP none

The User Account under which the Schedule service runs may require specific file access permissions, user permissions and drive mappings.

For the system account, /RU username can be written as "", "NT AUTHORITY\SYSTEM" or "SYSTEM", a Password is not required.

/SC schedule The schedule frequency.
Valid schedules: MINUTE,HOURLY,DAILY,WEEKLY,MONTHLY, ONCE,ONSTART,ONLOGON,ONIDLE.

/MO modifiers allow finer control:

MINUTE: 1 - 1439 minutes.
HOURLY: 1 - 23 hours.
DAILY: 1 - 365 days.
WEEKLY: weeks 1 - 52.
ONCE: No modifiers.
ONSTART: No modifiers.
ONLOGON: No modifiers.
ONIDLE: No modifiers.
MONTHLY: 1 - 12, or FIRST, SECOND, THIRD, FOURTH, LAST, LASTDAY.Task Scheduler options are stored in the registry

HKLM\SOFTWARE\Microsoft\SchedulingAgent\Examples:

Create a daily task to run at 11 pm

SCHTASKS /Create /SC weekly /D MON,TUE,WED,THU,FRI /TN MyDailyBackup /ST 23:00:00 /TR c:\backup.cmd /RU MyDomain\MyLogin /RP MyPassword

Delete the task above

SCHTASKS /Delete /TN "MyDailyBackup" /f


About the Author

FortyPoundHead has posted a total of 1974 articles.

 


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.158.195.221

Before you can post, you need to prove you are human. If you log in, this test goes away.



Recent Forum Posts

Malicious IP Checker Companion Tool
dwirch posted on August 12, 2017 at about 20:24 in Site News

Job Spammer: Steve Adams
dwirch posted on August 8, 2017 at about 7:44 in Spammers

New security implemented
dwirch posted on August 8, 2017 at about 6:43 in Site News

New security implemented
dwirch posted on July 23, 2017 at about 6:58 in Site News

Fold Code Manager into main KB?
VB6Boy posted on July 22, 2017 at about 14:42 in Site News

Fold Code Manager into main KB?
dwirch posted on July 22, 2017 at about 14:41 in Site News