轉載自 這裡
前言 :
命令 Schtasks : Schedules commands and programs to run periodically or at a specific time. Adds and removes tasks from the schedule, starts and stops tasks on demand, and displays and changes scheduled tasks.
使用說明 :
語法 :
schtasks /create /tn TaskName /tr TaskRun /sc schedule [/mo modifier] [/d day] [/m month[,month...] [/i IdleTime] [/st StartTime] [/sd StartDate] [/ed EndDate] [/scomputer [/u [domain\]user /p password]] [/ru {[Domain\]User | "System"} [/rp Password]] /?
參數 :
/tn TaskName : Specifies a name for the task.
/tr TaskRun :
/sc schedule :
/mo modifier :
/m month[,month...] :
/i IdleTime :
/st StartTime :
/sd StartDate :
/ed EndDate :
/s Computer :
/u [domain\]user :
/p password :
/ru {[Domain\]User | "System"} :
/d day :
/rp Password :
/?: Displays help at the command prompt.
註解 :
使用範例 :
* To schedule a task to run every 20 minutes
The following command schedules a security script, Sec.vbs, to run every 20 minutes. Because the command does not include a starting date or time, the task starts 20 minutes after the command completes, and runs every 20 minutes thereafter whenever the system is running. Notice that the security script source file is located on a remote computer, but that the task is scheduled and executes on the local computer.
schtasks /create /sc minute /mo 20 /tn "Security Script" /tr \\central\data\scripts\sec.vbs
In response, SchTasks.exe displays a message explaining that the task will run with the permissions of the current user and requests the current user's password. When you enter the password, SchTasks.exe obscures the text you type.
Then, SchTasks.exe displays a message indicating that the task is scheduled:
A query shows the task that the command scheduled:
* To schedule a command that runs every hour at five minutes past the hour
The following command schedules the MyApp program to run hourly beginning at five minutes past midnight. Because the /mo parameter is omitted, the command uses the default value for the hourly schedule, which is every (1) hour. If this command is issued after 12:05 A.M., the program will not run until the next day.
schtasks /create /sc hourly /st 00:05:00 /tn "My App" /tr c:\apps\myapp.exe
* To delete a task from the schedule of a remote computer
The following command deletes the "Start Mail" task from the schedule of a remote computer. It uses the /s parameter to identify the remote computer.
schtasks /delete /tn "Start Mail" /s Svr16
In response, SchTasks.exe displays the following confirmation message. To delete the task, type y. To cancel the command, type n:
* To delete all tasks scheduled for the local computer
The following command deletes all tasks from the schedule of the local computer, including tasks scheduled by other users. It uses the /tn * parameter to represent all tasks on the computer and the /f parameter to suppress the confirmation message.
schtasks /delete /tn * /f < /f means force>
In response, SchTasks.exe displays the following success messages indicating that the only task scheduled, SecureScript, is deleted.
* To display the scheduled tasks on the local computer
The following commands display all tasks scheduled for the local computer. These commands produce the same result and can be used interchangeably.
schtasks < or schtasks /query>
In response, SchTasks.exe displays the tasks in the default, simple table format, as shown in the following table:
前言 :
命令 Schtasks : Schedules commands and programs to run periodically or at a specific time. Adds and removes tasks from the schedule, starts and stops tasks on demand, and displays and changes scheduled tasks.
使用說明 :
語法 :
schtasks /create /tn TaskName /tr TaskRun /sc schedule [/mo modifier] [/d day] [/m month[,month...] [/i IdleTime] [/st StartTime] [/sd StartDate] [/ed EndDate] [/scomputer [/u [domain\]user /p password]] [/ru {[Domain\]User | "System"} [/rp Password]] /?
參數 :
/tn TaskName : Specifies a name for the task.
/tr TaskRun :
/sc schedule :
/mo modifier :
/m month[,month...] :
/i IdleTime :
/st StartTime :
/sd StartDate :
/ed EndDate :
/s Computer :
/u [domain\]user :
/p password :
/ru {[Domain\]User | "System"} :
/d day :
/rp Password :
/?: Displays help at the command prompt.
註解 :
使用範例 :
* To schedule a task to run every 20 minutes
The following command schedules a security script, Sec.vbs, to run every 20 minutes. Because the command does not include a starting date or time, the task starts 20 minutes after the command completes, and runs every 20 minutes thereafter whenever the system is running. Notice that the security script source file is located on a remote computer, but that the task is scheduled and executes on the local computer.
schtasks /create /sc minute /mo 20 /tn "Security Script" /tr \\central\data\scripts\sec.vbs
In response, SchTasks.exe displays a message explaining that the task will run with the permissions of the current user and requests the current user's password. When you enter the password, SchTasks.exe obscures the text you type.
Then, SchTasks.exe displays a message indicating that the task is scheduled:
A query shows the task that the command scheduled:
* To schedule a command that runs every hour at five minutes past the hour
The following command schedules the MyApp program to run hourly beginning at five minutes past midnight. Because the /mo parameter is omitted, the command uses the default value for the hourly schedule, which is every (1) hour. If this command is issued after 12:05 A.M., the program will not run until the next day.
schtasks /create /sc hourly /st 00:05:00 /tn "My App" /tr c:\apps\myapp.exe
* To delete a task from the schedule of a remote computer
The following command deletes the "Start Mail" task from the schedule of a remote computer. It uses the /s parameter to identify the remote computer.
schtasks /delete /tn "Start Mail" /s Svr16
In response, SchTasks.exe displays the following confirmation message. To delete the task, type y. To cancel the command, type n:
* To delete all tasks scheduled for the local computer
The following command deletes all tasks from the schedule of the local computer, including tasks scheduled by other users. It uses the /tn * parameter to represent all tasks on the computer and the /f parameter to suppress the confirmation message.
schtasks /delete /tn * /f < /f means force>
In response, SchTasks.exe displays the following success messages indicating that the only task scheduled, SecureScript, is deleted.
* To display the scheduled tasks on the local computer
The following commands display all tasks scheduled for the local computer. These commands produce the same result and can be used interchangeably.
schtasks < or schtasks /query>
In response, SchTasks.exe displays the tasks in the default, simple table format, as shown in the following table:
This message was edited 7 times. Last update was at 12/11/2010 14:38:10
沒有留言:
張貼留言