Jump to content

Automating Defrag with defrag.exe


Tripredacus

Recommended Posts

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??

Link to comment
Share on other sites


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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...