ScanDisk Runs After Improper Shutdown or Hard Disk Error

# Microsoft Knowledge Base

## ScanDisk Runs After Improper Shutdown or Hard Disk Error

Last reviewed: April 15, 1997 Article ID: Q152404

The information in this article applies to:

- Microsoft Windows 95
- Microsoft Windows 95 OEM Service Release 2

## SYMPTOMS

You may receive one of the following error messages when Windows 95 OEM Service Release 2 (OSR2) starts:

- Windows was not properly shut down. One or more of your disk drives may have errors on it. Press any key to run ScanDisk on these drives...
- One or more of your disk drives may have developed bad sectors. Press any key to run ScanDisk with surface analysis on these drives...

## CAUSE

These error messages can occur if your computer was not shut down properly or when an error occurs on a hard disk.

## RESOLUTION

To resolve these errors, press any key to allow ScanDisk to perform the necessary checks on all drives, and then choose to repair any errors found.

NOTE: To properly shut down Windows 95, click the Start button, click Shut Down, and then click Shut Down The Computer. You should not turn off the computer while Windows 95 is running unless the computer has stopped responding to mouse and keyboard input.

## MORE INFORMATION

OSR2 includes versions of the Io.sys and Win.com files that check the Clean Shutdown and Hard Disk Error bits in the Virtual File Allocation Table (VFAT) during startup. If either of these bits is turned on (that is, cleared to 0) on any drive present in real mode, you are prompted to run ScanDisk. If you do not press a key within 60 seconds, ScanDisk runs anyway.

The Clean Shutdown and Hard Disk Error bits are the two low-order bits of the FAT entry for cluster 1. If bit 0 is 0, it indicates an unclean shutdown; if bit 1 is 0, it indicates that a hard disk error occurred on that drive. These bits are turned on by VFAT; they are turned off only by ScanDisk. The Clean Shutdown bit is turned off upon completion of a standard run. The Hard Disk Error bit is turned off upon completion of a surface scan (regardless of whether errors were repaired).

If either of these bits is on for a real-mode drive, Win.com displays the appropriate error message. Pressing any key starts the following command:

       SCANDISK.EXE /CUSTOM x: [[y:] ...]

If the Hard Disk Error bit is on for any drive, the /SURFACE switch is included in the command. Note that if the Clean Shutdown bits are off, but one or more Hard Disk Error bits is on, you receive a different error message about why ScanDisk is being started.

If ScanDisk does not find any errors, or if you choose to fix all errors, ScanDisk should finish and Windows 95 should continue loading. Note that the default behavior of the /CUSTOM switch is that ScanDisk displays a summary screen if any errors are found, but if not, ScanDisk quits silently.

If Scandisk.exe is not found, Win.com displays the following error message:

       SCANDISK.EXE could not be found. You may have problems on your disks(s)
       that require repairing. Press any key to continue starting Windows...

If you quit ScanDisk early, leaving errors on the disk, or if ScanDisk is unable to finish, Win.com displays the following error message:

       There was an error running SCANDISK.EXE, or it was canceled. You may
       still have errors on your disk(s). Press any key to continue starting
       Windows...

NOTE: If ScanDisk does not reach the point where it turns the Clean Shut- down and Hard Disk Error bits off, ScanDisk runs again the next time your computer starts.

### Autoscan Settings in Msdos.sys File

To modify this default behavior, the following new settings have been defined for the [Options] section of the Msdos.sys file:

- AUTOSCAN=0

  This turns the new feature off completely. The kernel does not check the Clean Shutdown and Hard Disk Error bits, and ScanDisk is not started.

- AUTOSCAN=1

  This is the default behavior described above.

- AUTOSCAN=2

  This is the same as the default behavior, but no error message is displayed before ScanDisk is started. ScanDisk starts with no prompt.

NOTE: You can also automate ScanDisk so that no user intervention is required by editing settings in the C:\Windows\Command\Scandisk.ini file and specifying the actions you want ScanDisk to take in Custom mode.