Problem: I ran windows defrag tool couple of times, but want to automate it. Also want to log the results.
Solution:
- Login as Admin or with an account that has administrator privileges.
- Copy the following lines to a text file, name it as "defrag_bat.bat" and store it C:\Windows\System folder.
- Create folder called C:\Temp if it is not present already.
Echo ////////////////////////////////////////////////////////////// >> c:\Temp\Defrag.log
Echo Defrag started at @ && Date/T >> c:\Temp\Defrag.log && Time/T >> c:\Temp\Defrag.log
Echo ////////////////////////////////////////////////////////////// >> c:\Temp\Defrag.log
defrag c: /f >> c:\Temp\Defrag.log
Echo Defrag Ended at @ && Date/T >> c:\Temp\Defrag.log && Time/T >> c:\Temp\Defrag.log
Echo ////////////////////////////////////////////////////////////// >> c:\Temp\Defrag.log
- Schedule a Task to run it at a time you are not supposed to use the computer.
I used to have automatic defragmentation set-up in my old pc but it took for ever to complete. Now I have copied most of my data to a backup drive.
ReplyDeleteIf it is taking for ever, that means
ReplyDeletethere is not enough free disk space. Usually if you have at least
10% free disk space of the entire disk capacity, and if you DO NOT have big files (when you dump
a DV Movie from a Cam Corder with DV quality the file size will be 13
GB for 1 Hr Video), first time defrag may take few to several hours.
Subsequent defrag attempts will not take more than an hour or so, if you are doing once in every week or after a memory intensive disk usage,
depending on fragmentation. One more important thing is clean
the system before defragging
There could be another reason that the page file is fragmented too much. Fix the page file problem first after making sure you have at least few GB of free disk space.