Scheduling Defrag via the Command Prompt

Status
Not open for further replies.

microsoftne

In Runtime
Messages
469
In the above , I showed how to defrag from the command prompt, but how about scheduling a defrag? Well, it's just as simple and requires no batch file.

Open the command prompt START==>All Programs==>Accessories==>Command Prompt

Now type at /? then enter and were presented with these options:


AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the
day (for example, next Thursday). If date is omitted, the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.



I want to defrag my hard drive c: on Monday, Wednesday, and Friday at 11 p.m. and keep it interactive. (allows visual progress).

C:\>at 23:00 /interactive /every:M,W,F defrag c:



....and I'm presented with:


C:\Documents and Settings\XPUSER>at 23:00 /interactive /every:M,W,F defrag c:
Added a new job with job ID = 1



To list your scheduled jobs, just type at at the prompt, then enter:

C:\Documents and Settings\Rock.MICHAELB1>at
Status ID Day Time Command Line
------------------------------------------------------------------
1 Each M W F 11:00 PM defrag c:


To delete pending jobs, just follow the syntax:

/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.



So to cancel my job with ID 1:

at 1 /delete
 
Status
Not open for further replies.
Back
Top Bottom