Table Of Contents
This is the Third Step in the Fresh Computer Series.
- Update Windows (Optional)
- Automate Hard Drive Cleaning
- Automate Hard Drive Defragmentation
- Automate A Reboot
- Automatically Open Your Browser
- Conclusion
Schedule The Task
- Navigate to: Control Panel -> Scheduled Tasks -> Add Scheduled Task
(Alternately, you run this from the Run dialog: control schedtasks)

- Hit Next in the dialog box that opens.
- In the Scheduled Task Wizard, put this in the address bar [1]:
%SystemRoot%\system32\defrag.exe - Click Next. You could set this to run Daily but that’s not really necessary. We’ll set the defrag time to Weekly.

- Click Next. Enter the time and date for the task. Set the Start time for 4:30 AM every 1 weeks, select the day of the week as Monday.

- In the next screen, enter in the username and the password for your Windows user account [2].

- Tick the “Open advanced properties for this task when I click Finish.” checkbox and click the Finish button.

- In the advanced settings, look for the Run text field. We need to add a space, then the drive letter of the drive we want to defragmant, to the end of the path:
c:\windows\system32\defrag.exe C:

- Click the Set password… button (right of the Run as textbox with your username) and add your Windows password [3]

- Click OK in all dialogs.
Next, we can proceed to Fresh Computer Series Step Four: Automate A Reboot.
[1] I had you use the %systemroot% variable just in case you’ve installed Windows in a location other then the default
The actual location for the Disk Defragmenter should be:
C:\WINDOWS\system32\defrag.exe
[2] This user needs to be a System Administrator.
[3]Even though you put in your password in the sixth step, you have to type it again.
Another good one! By the way is it possible to let the defrag run in the background silently?
Thanks!
Unfortunately, you can’t specify a “silent” perimeter through the Command Line or through the Task Scheduler for defrag.exe, but if you use a third party deframenter like Diskeeper. Diskeeper does have a option to run in the background.
I like Disk Defrag from auslogics dot com. Free, but I don’t think you can do an auto run. Quick too.
Yeah this is a good one for sure.. it helps speed things up on you machine!
Aye, thanks for this one. I always forget to defrag now and then. If only everything would be automatic…
I’ve always wondered (not enough to look for the answer however) why windows requires defrag and unix operating systems do not. Is there something about unix file systems that make defrag unnecessary?