Home > Commands N-Z > Commands S

SCANDISK


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Starts Microsoft ScanDisk, a disk analysis and repair tool that checks a drive for errors and corrects any problems that it finds. For an introduction to using ScanDisk, see An Introduction to ScanDisk.


Syntax

To check the current drive for disk errors:

SCANDISK

To check one or more drives for disk errors:

SCANDISK [drive: [drive: ...] | /ALL] [/CHECKONLY | /AUTOFIX [/NOSAVE] | /CUSTOM] [/SURFACE] [/MONO] [/NOSUMMARY] [/CLIP] [/HELP] [/MOUNT] [/NEW] [/NOLOST] [/NOUI] [/TEXT] [/TIME]

To check an unmounted compressed volume file for errors:

SCANDISK volume-name [/CHECKONLY | /AUTOFIX [/NOSAVE] | /CUSTOM] [/MONO] [/NOSUMMARY]

To check a file or files for fragmentation:

SCANDISK /FRAGMENT [drive:][path]filename

To undo repairs you made previously:

SCANDISK /UNDO [undo-drive:] [/MONO]


Parameters
drive: (v6.2)
Specifies the drive or drives you want to check and repair.
[drive:] ( [path] filename v6.2)
Specifies the file(s) you want to examine for fragmentation. You can also specify wildcards for the filename.
undo-drive: (v6.2)
Specifies the drive containing the Undo disk.
volume-name (v6.2)
Specifies the name of the unmounted compressed volume file you want to check and repair. The volume-name parameter should take the form [drive:\]DRVSPACE.nnn, in which drive specifies the drive that contains the volume file and nnn specifies the extension of the volume file. For example, H:\DRVSPACE.000.

Switches
/ALL (v6.2)
Checks and repairs all local drives.
/AUTOFIX (v6.2)
Fixes damage without prompting you first. By default, if you start ScanDisk with the /AUTOFIX switch and ScanDisk finds lost clusters on your drive, it saves the lost clusters as files in the drive's root directory. To have ScanDisk delete lost clusters rather than saving them, include the /NOSAVE switch. (If you use the /AUTOFIX switch and ScanDisk finds errors, it still prompts you for an Undo disk; to prevent this, include the /NOSUMMARY switch.) You cannot use the /AUTOFIX switch in conjunction with the /CHECKONLY or /CUSTOM switches.
/CHECKONLY (v6.2)
Checks a drive for errors, but does not repair any damage. You cannot use this switch with the /AUTOFIX or /CUSTOM switches.
/CLIP (v7.00)
UNDOCUMENTED. Change long to short (8dot3) filenames.
/CUSTOM (v6.2)
Runs ScanDisk using the configuration settings in the [Custom] section of the SCANDISK.INI file. This switch is especially useful for running ScanDisk from a batch program. You cannot use this switch in conjunction with the /AUTOFIX or /CHECKONLY switches.
/FRAGMENT (v6.2)
Checks a file (or files) for fragmentation. You must use this switch without any other switch.
/HELP (v6.0)
UNDOCUMENTED. Same as /?.
/MONO (v6.2)
Configures ScanDisk to use a monochrome display. Instead of specifying this switch every time you run ScanDisk, you can include the DISPLAY=MONO line in your SCANDISK.INI file.
/MOUNT (v7.00)
UNDOCUMENTED. Mounts DRVSPACE volume. (Same as SCANDISK.INI Mount=Always).
/NEW (v7.00)
UNDOCUMENTED. unknown?
/NOLOST (v7.00)
UNDOCUMENTED. Does not prompt for surface scan. No check for lost clusters.
/NOSAVE (v6.2)
Directs ScanDisk to delete any lost clusters it finds. Can be used only in conjunction with the /AUTOFIX switch. (If you start ScanDisk with the /AUTOFIX switch and omit the /NOSAVE switch, ScanDisk saves the contents of any lost clusters as files in the root directory of the drive.)
/NOSUMMARY (v6.2)
Prevents ScanDisk from displaying a full-screen summary after checking each drive. (This switch also prevents ScanDisk from prompting you for an Undo disk if it finds errors.)
/TEXT (v7.00)
/NOUI (v7.00)
/TEXT (v7.00)
UNDOCUMENTED. Uses DOS TEXT interface instead of Windows graphical interface.
/SURFACE (v6.2)
Automatically performs a surface scan after checking other areas of a drive. During a surface scan of an uncompressed drive, ScanDisk confirms that data can be reliably written and read from the drive being scanned. During a surface scan of a compressed drive, ScanDisk confirms that data can be decompressed. You should periodically do surface scans of all drives.
By default, when it has finished checking a drive's file system, ScanDisk asks whether or not you want to perform a surface scan. However, if you specify the /SURFACE switch, ScanDisk proceeds with the surface scan without prompting you first. When /SURFACE is used in conjunction with the /CUSTOM switch, it overrides the Surface setting in the [Custom] section of the SCANDISK.INI file.
/TIME (v6.0)
UNDOCUMENTED. Marks sectors that take longer than usual to read during Surface scan. (Same as SCANDISK.INI ScanTimeOut=On).
/UNDO (v6.0)
Undo repairs made previously.

Related

none.


Notes
Problems fixed by ScanDisk

ScanDisk checks and fixes problems in:

In addition, ScanDisk also checks and fixes DriveSpace or DoubleSpace compressed drive:


Types of drives

ScanDisk can find and fix errors on:

ScanDisk cannot find or fix errors on:


Using ScanDisk when other programs are running

Do not use ScanDisk to repair a drive when other programs are running. ScanDisk is designed for use when files on a disk are in an unchanging state. When you are using a file, the operating system updates the file allocation table (FAT) and the directory structure to reflect changes. Such updates are not always made immediately. If you run ScanDisk when other programs are running, files might still be open. ScanDisk interprets differences between the directory structure and the file allocation tables as errors. This can result in corruption or loss of data.

You cannot use ScanDisk to correct disk errors if you start it from another program, or when Microsoft Windows or the operating system Task Swapper are running. However, you can check your disk without fixing errors by using the SCANDISK command with the /CHECKONLY switch. If you run it with Windows, ScanDisk might detect errors that do not exist when Windows is not running.


Using ScanDisk with PC-DOS 6.1

Do not run ScanDisk on any (PCDOS6.10) compressed drive. If you do, you will lose all data on that drive. ScanDisk is compatible only with the operating system compressed drives (DriveSpace drives and DoubleSpace drives) and is not designed to run on PC-DOS compressed drives.


Using ScanDisk on DoubleSpace Drives

If DoubleSpace is installed (that is, if DBLSPACE.BIN is loaded into memory), ScanDisk can check and repair DoubleSpace drives and unmounted DoubleSpace compressed volume files. ScanDisk can also check and repair DoubleSpace drives and volume files if the DBLSPACE.BIN and DRVSPACE.MR1 files are available. Otherwise, ScanDisk does not work on DoubleSpace drives or unmounted DoubleSpace compressed volume files. For more information about the DRVSPACE.MR1 file, see DBLSPACE--Notes. (For more information about using DoubleSpace with v6.22, see DBLSPACE.)


The SCANDISK.INI file

The SCANDISK.INI file is a text file located in the directory that contains your operating system files. The settings in the [Environment] section of the SCANDISK.INI file determine certain aspects of ScanDisk's behavior, such as whether it is configured for a monochrome or color display. The settings in the [Custom] section determine the default behavior of ScanDisk when you start it with the /CUSTOM switch.

For more information, read the comments in the SCANDISK.INI file.


Undoing the changes ScanDisk made

If ScanDisk finds errors on your drive, the program gives you the option of creating an Undo disk, which enables you to undo the changes ScanDisk makes to your drive. The Undo disk contains information that specifies which drive it applies to as well as information on every change that ScanDisk made to that drive.

CAUTION: Use the Undo disk to undo changes only if your drive has not changed since that Undo disk was created. If you changed any of the files on your drive since you created the Undo disk, do not try to undo your changes. If you attempt to use the Undo disk after you update a file or directory, or copy or delete a file, you might damage your drive structure and lose data.


Examples

To check and fix the current drive, type:

    SCANDISK

Suppose that DriveSpace is installed, but is unable to mount your compressed drive because of problems with the drive. The drive's compressed volume file is called DRVSPACE.000 and is located in the root directory of drive C. To repair the volume file, type:

    SCANDISK C:\DRVSPACE.000

The DriveSpace volume file must be located in the root directory of the drive.


To check both drive C and drive E, type:

    SCANDISK C: E:

To check all your drives, type:

    SCANDISK /ALL

This will check all your hard disk partitions, in addition to all mounted DriveSpace drives (if DriveSpace is installed).


Suppose you created an Undo disk, did not change the contents of the checked drive since you created the Undo disk, and placed the Undo disk in drive A. To undo the changes made by ScanDisk, type:

    SCANDISK /UNDO A:

Introduction
An Introduction to ScanDisk

ScanDisk is a full-featured disk analysis and repair program. It is designed to work on both uncompressed drives and compressed drives.


Starting ScanDisk

To start ScanDisk, type:

    SCANDISK

ScanDisk begins checking the current drive. If ScanDisk finds any problems, it displays a dialog explaining the problem.

To check a specific drive, type the drive letter after the ScanDisk command. For example, to check drive D, type:

    SCANDISK D:

Running ScanDisk

If ScanDisk doesn't find any problems with your drive, you don't have to do much. Just let it run, and when it completes, choose the Exit button at the bottom of the screen by typing X or by clicking Exit with the mouse.

If ScanDisk finds a problem, it displays a Problem Found dialog that briefly explains the problem and what will happen if you fix it. Most Problem Found dialogs have a Fix It button, a Don't Fix It button, and a More Info button. To have ScanDisk correct the problem, choose the Fix It button.


Using the More Info dialogs

Most ScanDisk screens and dialogs include a More Info button. This displays another dialog with more information -- usually additional technical details -- about the current screen. For some types of problems, the More Info dialog lists the names of affected files.


ScanDisk and compressed drives

If you run ScanDisk on a mounted or unmounted compressed drive, it offers to check the host (physical) drive first. In general, you should allow it to do so, since an error on the host drive could cause problems with the compressed drive.

Note: To run ScanDisk on a DoubleSpace compressed drive, DoubleSpace must either be installed (DBLSPACE.BIN loaded in memory) or the files DBLSPACE.BIN and DRVSPACE.MR1 must be available. For more information about using DoubleSpace with v6.22, see DBLSPACE. For more information about the DRVSPACE.MR1 file, see DBLSPACE--Notes.


Creating an Undo disk

If ScanDisk finds a problem and you choose Fix It, ScanDisk offers to create an Undo floppy disk that you can later use to restore your disk to its previous state. You can restore your disk's previous state only if you haven't changed it since making repairs. Creating an Undo disk is easy -- you just insert a blank, formatted floppy disk in drive A or drive B, and then choose the Drive A or Drive B button in the dialog ScanDisk displays.


Customizing ScanDisk by using the SCANDISK.INI file

The SCANDISK.INI file contains settings that determine many aspects of ScanDisk's behavior. Most of the settings determine how ScanDisk will behave if you start it with the /CUSTOM switch. You can also use the settings in SCANDISK.INI to control other aspects of ScanDisk's behavior; for example, to prevent ScanDisk from prompting you for an Undo disk, just change the Undo setting in SCANDISK.INI to "Never". For more information about SCANDISK.INI, see the comments within the file.


Errorlevels
Availability
External
DOS
v6.2 v6.21 v6.22 v6.23 v7.00 v7.0R1 v7.10
Windows
none
Windows NT
none