3.10. Checking a Volume for Errors
You want to check a volume for errors.
Using a graphical user interface
Open Windows Explorer.
Right-click the drive you want to defragment and select Properties.
Click the Tools tab.
Under Error-checking, click the Check Now button.
If you want to fix any file system errors that are found, check the box beside Automatically fix file system errors. If you want to perform a thorough scan of the disk and check for bad sectors, check the box beside Scan for an attempt recovery of bad sectors.
Check the disk options you want and click Start.
Click OK when the check completes.
Using a command-line interface
The chkdsk utility can detect problems with a volume and attempt to fix them. Specify the name of the volume you want to check to run chkdsk in read-only mode:
> chkdsk D:
/f option to have
chkdsk attempt to fix any
errors it finds:
> chkdsk D: /f
chkdsk will try to lock the
drive, so if it is in use by another process, you will only be able
to schedule it to run during the next reboot. You can include the
/x option with
/f to force the volume to be dismounted
(for a nonsystem volume).
' This code tries to perform a chkdsk on the specified volume. ' ------ SCRIPT CONFIGURATION ------ strComputer = "." strDrive = "
<Drive>" ' e.g., D: boolFixErrors = True ' True = chkdsk /f, False = chkdsk ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set objDisk ...