Defrag batch file

Associate
Joined
3 Jan 2009
Posts
2,056
Location
London
Hi all, I'm not particualry good at writing batch files, so could anyone help me?

I want to put a batch file on the hard drive of a computer and then be able to run it from the server so it defrags the computer.

Help please :D 'start defrag.exe' is as far as I've got so far...
 
in the batch file if you put

defrag.exe /C /U /V >C:log.txt

it will run a defrag if necessary and save it all to a log file in C:\

You can change the /C switch for drive letters like this
defrag.exe C: D: /A /U /V >C:log.txt

Parameters:
Value Description
/A Perform analysis on the specified volumes.
/C Perform the operation on all volumes.
/E Perform the operation on all volumes except those specified.
/H Run the operation at normal priority (default is low).
/M Run the operation on each volume in parallel in the background.
/T Track an operation already in progress on the specified volume.
/U Print the progress of the operation on the screen.
/V Print verbose output containing the fragmentation statistics.
/X Perform free space consolidation on the specified volumes.
 
Last edited:
Back
Top Bottom