Appendix How to Automate Chkdsk




Download 0,81 Mb.
bet44/45
Sana21.03.2017
Hajmi0,81 Mb.
#829
1   ...   37   38   39   40   41   42   43   44   45

Appendix

How to Automate Chkdsk


If you run Chkdsk with the /f command-line switch to fix corruption, in most cases there will be locked files, and you must restart the computer to have exclusive access to the partition or partitions. Typically, you have to press Y to schedule Chkdsk to run in write-mode on the next restart. However, you can automate this process so that no user intervention is required.

To automate Chkdsk, create the following batch file, and then disseminate it to the preferred system or systems:



@echo off

echo y|Chkdsk [destination drive:] /f/r

rem sleep 3600

rem c:\utils\shutdown.exe /l /r /y /t:6

The last two lines are optional. Sleep.exe and Shutdown.exe are from the Windows Resource Kit. “Sleep 3600” causes the system to wait for 60 minutes before proceeding to the next line in the batch file. Shutdown.exe is then called to shut down and then restart the target system. If Shutdown.exe is not called, and the drive could not be locked for exclusive use, Chkdsk runs the next time you manually restart the target system.

If you want to schedule Chkdsk, or this batch file, to run on specific days or times, use the Task Scheduler or AT Scheduler (the command-line interface).


Download 0,81 Mb.
1   ...   37   38   39   40   41   42   43   44   45




Download 0,81 Mb.