@echo off setlocal rem set the place where you located contig.exe here set contig="C:\Program Files\sysinternals.com\contig\Contig.exe" echo. echo contigReport version 1.0 (2003-01-24) - Launches a contig.exe command on every file quoted in a Windows 2000/XP report file echo author: MLL02 (http://mll02.cjb.net) echo This piece of code is provided as-is (i.e. don't cry at me if it messes your system), but it should work. ;) echo Feel free to report me bugs, redistribute it and improve it. In the latter case, thanks for sending me a copy. echo. echo Launching... echo. if not exist %contig% goto :contignotexist if #%1# == ## goto :syntax if not exist %1 goto :notexist rem automatic recognition of drive for /F "delims=() Tokens=2" %%i in ('type %1') do call :setdrive %%i goto :startcontig :startcontig echo Contig launched on each file quoted in %1 echo. for /F "skip=36 delims=\ Tokens=1*" %%i in ('type %1') do call :docontig "%mydrive%\%%j" echo. echo End of process goto :end :syntax echo ERROR: you have to give the report file name as argument. goto :end :contignotexist echo ERROR: %contig% (the defragmenter file) doesn't exist. echo Go to http://www.sysinternals.com/ntw2k/freeware/contig.shtml to grab it echo and set its location by editing %~f0 notepad %~f0 goto :end :notexist echo ERROR: %1 (the report file) doesn't exist. goto :end :setdrive rem trick to have only the first stuff between brackets retained if #%mydrive%#==## set mydrive=%1 goto :eof :docontig if %1 == "%mydrive%\" goto :eof echo. echo Next file: echo %1 %contig% -v %1 goto :eof :end echo. pause