MSFN Forum: Automating Defrag with defrag.exe - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

If you have questions about customizing Windows XP that are nLite-specific, please post them in the nLite forum, not here. If you have questions regarding the unattended installation of Windows XP, please post them in the Unattended Windows 2000/XP/2003 section.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Automating Defrag with defrag.exe Rate Topic: -----

#1 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 7,349
  • Joined: 28-April 06
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 21 March 2008 - 08:51 AM

I created a script that defrags a computers 2 volumes and then restarts. I am not using the /noprompt switch because when I did use it, the computer would reboot while it was running.

As a test I changed the script to just run the defrag on the one drive, which uses the following cmd:

defrag c: /f


Now It just has a DOS box up with fragmentation stats on it but doesn't seem to be doing anything. The computer isn't locked up, but the HD LED is on constant. Task Manager shows 00:00 for CPU time for defrag.exe.

Is this normal for it to take a long time and not seem to be doing anything??


#2 User is offline   Andromeda43 

  • Retired PC Tech.
  • PipPipPipPipPip
  • Group: Members
  • Posts: 984
  • Joined: 14-August 05
  • OS:XP Pro x86
  • Country: Country Flag

  Posted 21 March 2008 - 10:41 AM

View PostTripredacus, on Mar 21 2008, 09:51 AM, said:

I created a script that defrags a computers 2 volumes and then restarts. I am not using the /noprompt switch because when I did use it, the computer would reboot while it was running.

As a test I changed the script to just run the defrag on the one drive, which uses the following cmd:

defrag c: /f


Now It just has a DOS box up with fragmentation stats on it but doesn't seem to be doing anything. The computer isn't locked up, but the HD LED is on constant. Task Manager shows 00:00 for CPU time for defrag.exe.

Is this normal for it to take a long time and not seem to be doing anything??


I keep my HD squeaky clean and defragmented on a weekly basis so I'm probably not seeing the same thing you are.
I just ran defrag C: /v from a command prompt, /v because I wanted to see the full report of what it found.
It only ran for about five minutes and gave me a real nice status report.

I normally just run defrag from a desktop icon and let it do its thing while I do something else.
I enjoy watching the little red lines disappear and the white spaces get filled up with blue. :thumbup

Cheers Mate!
Andromeda43 B)

#3 User is offline   GeneralMandible 

  • Major
  • PipPip
  • Group: Members
  • Posts: 223
  • Joined: 08-July 04

Posted 21 March 2008 - 11:38 AM

View PostTripredacus, on Mar 21 2008, 07:51 AM, said:

I created a script that defrags a computers 2 volumes and then restarts. I am not using the /noprompt switch because when I did use it, the computer would reboot while it was running.
........
Now It just has a DOS box up with fragmentation stats on it but doesn't seem to be doing anything. The computer isn't locked up, but the HD LED is on constant. Task Manager shows 00:00 for CPU time for defrag.exe.

Is this normal for it to take a long time and not seem to be doing anything??


It only displays what it found before defragging. It is not a dynamic page. It does take a while depending on a lot of different factors. If you want a dynamic display from the command line, use DirMS.

As far as the restart while it runs, try using this:
start /wait defrag c: -f


The "start /wait" tells windows to run the command, but wait for it to finish to run the next command.

Hope this helps.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy