Freigeben über


How to run Defrag on a scheduled basis

On Windows XP, it's simple. Just run this command and you are done:

schtasks /create /TN defrag /RU "NT AUTHORITY\SYSTEM" /SC weekly /TR "defrag %systemdrive%"

Comments

  • Anonymous
    April 07, 2006
    Is it the same for Win 2003 ?

    Thanks

    Garry
  • Anonymous
    April 07, 2006
    The same command should work on Windows Server 2003 as well.
  • Anonymous
    April 11, 2006
    I have to say that I've not exactly been alltogether impressed by defrag.exe.

    In my experience, at least for systems where you can afford planned downtime, the best way to really defrag a partition is to back the whole thing up, wipe the partition, then restore it (a-la ntbackup).  Of course, defrag bogs down the system enough that you pretty much need to schedule downtime anyway.

    Naturally, this is easier to do if you properly separate the partition the OS is installed on from the partition you have other programs or data on.
  • Anonymous
    May 02, 2006
    Thank goodness that Windows has displaced the user-unfriendly Unix with
    its obscure commands and single letter flags :-)  Now we have two letter flags; twice as good!
  • Anonymous
    July 20, 2006
    This isn't that big of a deal, but since some articles make it sound like this is a difficult thing,...