| Automate Chkdsk and Defrag on WinXP machines |
|
|
|
| Written by Administrator |
|
Automate Chkdsk and Defrag on WinXP machines Using the fileTo put the file to work, follow these steps: 1. Copy the code in Listing A. 2. Open Notepad and paste in the code. 3. Save the file as Dskchk.cmd. 4. Create DrvLtr.txt and list the letters of the drives you want checked, with each letter on its own line. Under the last drive letter, type the word end. For example: C: F: end 5. Put Dskchk.cmd and DrvLtr.txt in the same directory. You can then schedule Dskchk with Task Scheduler or run it manually. Listing A 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 |
| Last Updated on Sunday, 24 January 2010 01:14 |


