I am attempting to make a massive rollout that I am doing easier by creating a bat file on a flash drive that will do a defrag and scandisk on the local computer (c:\).
I have created two files:
The main bat file and text document that contains the drive information:
Here are the contents:
*****bat File*****
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%
chkdsk /f /r
goto :defrag
:dskchkon
chkdsk %DrvLtr% /f /r
:defrag
cd\
%DrvLtr% defrag %DrvLtr% -b
defrag %DrvLtr%
shutdown -r -c “Rebooting for latest updates.”
:EOF
******** Text*****
c:
end
I have 1700 computers to rollout. Any suggestions on how I can get this bat to run from a flash drive and work on the local hard drive would be appreciated.