I implemented a script I downloaded from techrepublic called chkfrag_defrag.zip. Anyways, the document talks about being able to automate the script with XP’s Task Scheduler.
I found that if I don’t run the command script from the dos shell, it doesn’t appear to run at all. Is there a work around this? The script is as follows:
REM chkdsk and defrag automation
for /F “eol= tokens=1 delims=( ” %%i in (DrvLtr.txt) do set DrvLtr=%%i& call :dsKchk
:dsKchk
If %DrvLtr% == end goto :eof
chkdsk %DrvLtr%
If not errorlevel 3 goto :defrag
If not exist %DrvLtr%\winnt If not exist %DrvLtr%\windows If not exist %DrvLtr%\pagefile.sys goto :dskchkon
:dskchkoff
cd\
%DrvLtr%
echo Y chkdsk /F /R
goto :defrag
:dskchkon
chkdsk %DrvLtr% /F /R
:defrag
cd\
%DrvLtr%
defrag %DrvLtr% -b
defrag %DrvLtr%
:EOF