DOS Command Line Switches


 

DOS Command Line Parameters

These are primarily the uncommon and undocumented switches

Click the appropriate tab to display the switches that can be used with that particular command.

DOS command switches are always preceded with a forward slash (/) and there is always a space between the command and the first switch. You must press the Enter key before the command will be executed.

Take note that many of these switches or combinations thereof have warnings attached. When you see a warning, read and heed.

 
Command (command.com)   this is the basic command interpreter
Command /D /F /T
 /D (Deny) Performs different actions depending on the MS-DOS version:
  1. in MS-DOS 5.00: used on the CONFIG.SYS file SHELL= line prevents the execution of the AUTOEXEC.BAT file (if present) at bootup.
  2. in MS-DOS 6.xx and 7.xx / 8.00 [a.k.a. MS Windows 9x/ME]: disables the automatic floppy "Fail" response if enabled by the /F (FAIL) parameter (see "COMMAND /F" below).

    [MS-DOS 5.00 and above ONLY]

/F (Fail) Removes the "Abort, Retry, Fail" message and forces a "Fail" response to all "Abort, Retry, Fail" prompts issued by the DOS critical error handler. If the floppy disk is not ready it automatically goes to "Fail".

    [MS-DOS 6.00 and above ONLY]

/T Forces the COMMAND.COM resident module to load permanently in low memory (below the 640K barrier), even if the Upper Memory Area (UMA) is enabled by an upper memory manager (i.e. EMM386.EXE or UMBPCI.SYS) from CONFIG.SYS. Using /T in combination with the /P (PERMANENT) parameter, ONLY from the DOS prompt or in batch files (NOT from the CONFIG.SYS SHELL= line), also executes the AUTOEXEC.BAT file (if present), besides forcing the COMMAND.COM resident module to load permanently in low memory.

WARNING:
Using /T on the CONFIG.SYS SHELL= line may lock up Windows 9x / ME GUI upon shut down!

    [Windows 95 + MS-DOS 7.00 and above ONLY]

 

  WARNINGS:

BACKUP ALL YOUR DATA TO A SAFE LOCATION (not on your hard drive!) before using FDisk.

All data on the hard drive will be destroyed.

Use ALL FDISK.EXE command line switches with CAUTION, ONLY from native/real MS-DOS mode.

NOT from a Windows DOS box/session prompt, even full screen.

 

FDisk  The DOS partitioning tool.

Please NOTC: These command switches are book marked.  Just click on the command switch to jump to that section.

fdisk [/FPRMT] [FDISK x /PRI:n (/PRIO:n) /EXT:n /LOG:n (/LOGO:n)] [/MBR] [/Q] [/STATUS] [/X] [/ACTOK] [/CMBR x] [/PARTN] [/PRMT]

/FPRMT Bypasses the FDISK startup screen, but enables interactive FAT16/FAT32 support. This can be used to force FDISK to create FAT32 partitions smaller than 512 MB, normally not possible by default.

    [Windows 95B OSR 2.0 + MS-DOS 7.10 and above ONLY]

FDISK x /PRI:n (or /PRIO:n) /EXT:n /LOG:n (or /LOGO:n) MUST be used together for proper operation.

    [MS-DOS 6.00 and above ONLY]

Meanings:

x Drive number: 1, 2, 3... etc. Drive 1 corresponds to the 1st hard disk installed (C), drive 2 to second hard disk (D)... etc.
/PRI:n Creates a primary partition of size n (in MegaBytes) and makes it bootable (active).
/PRIO:n Creates a primary partition of size n (in MegaBytes) and makes it bootable (active) while overriding FAT16/FAT32.
/EXT:n Creates an extended partition of size n (in MegaBytes) which holds logical partition(s).
/LOG:n Creates a logical drive in the extended partition of size n (in MegaBytes).
/LOGO:n Creates a logical drive in the extended partition of size n (in MegaBytes) while overriding FAT16/FAT32.
If using FAT16 maximum size allowed is 2,047 MB (2 GigaBytes).
If using FAT32 maximum size allowed is 2,047 GB (2 TeraBytes).

NOTES:
Maximum partition size MUST be equal to or smaller than existing free disk space.
/EXT:n and /LOG:n (or /LOGO:n) partition sizes MUST be identical.
Only one FDISK "LOG" is allowed per EACH logical drive! Therefore on computers with more than one logical drive you MUST run a separate FDISK x
/LOG:n (or /LOGO:n) command for EACH installed drive.
ONLY IF using Windows 95B OSR 2.0 + MS-DOS 7.10 or newer: /PRI:n and /LOG:n default to FAT32 on partitions larger than 512 MB, or to FAT16 on partitions smaller than 512 MB. /PRIO:n and /LOGO:n default to FAT16 even on partitions larger than 512 MB, same as older MS-DOS 5.00/6.xx FDISK.
ONLY Windows 95 B/C OSR 2.0 - 2.5, 98, 98 SE, 2000, ME, XP and .Net support FAT32.
Use /LOGO:n instead of /LOG:n and/or /PRIO:n instead of /PRI:n to ignore FAT information in case of disk access errors.
/MBR Recreates the boot sector of the first (bootable) hard disk overwriting it with a fresh copy, by writing a new Master Boot Record (MBR) based on existent disk structure, without altering the partition table information. It can be used to repair a damaged/corrupted MBR (i.e. by a virus) but you must read the warnings below.

FDISK /MBR Rewrites the Master Boot Record
The MS-DOS Fdisk utility usually updates the master boot record only if no master boot record exists. Repartitioning with Fdisk does not rewrite this information.

    [MS-DOS 6.00 and above ONLY]

WARNINGS:

Writing the master boot record to the hard disk in this manner can make certain hard disks partitioned with SpeedStor unusable. It can also cause problems for some dual-boot programs and disks with more than four partitions.

This option should NOT be used if any of the following conditions exist:
  • The disk was partitioned using disk overlay software.
  • More than four partitions exist.
  • Certain dual-boot programs are in use.
  • A disk overlay redefines the drive's physical parameters (cylinder, head, and sector). It stores information on how the drive has been changed in an area of the master boot record that MS-DOS does not use. The FDISK /MBR command erases that information, making the disk unusable.
  • Some older original equipment manufacturer (OEM) versions of MS-DOS and some third-party partitioning utilities can create more than four partitions. Additional partition information is commonly stored information on partitions in an area that FDISK /MBR overwrites.

Some dual-boot programs have a special MBR that asks you at startup which operating system you want to use. FDISK /MBR erases this program. Dual-boot systems that boot whichever partition is marked Active are not affected by FDISK /MBR

 
More Information About The MBR:

What is the MBR?

At the end of the ROM BIOS bootstrap routine, the BIOS reads and executes the first physical sector of the first floppy or hard disk drive on the system. This first sector of the hard disk is called the master boot record (or sometimes the partition table or master boot block). At the beginning of this sector of the hard disk is a small program. At the end of this sector is where the partition information, or partition table, is stored. This program uses the partition information to determine which partition is bootable (usually the first primary DOS partition) and attempts to boot from it. This program is what is written to the disk by FDISK /MBR and is usually called the master boot record. During normal operation, Fdisk writes this program to the disk only if there is no master boot record.

Why is the MBR Changed During Setup?

During installation of Microsoft MS-DOS Upgrade, Setup replaces the master boot record on the hard disk with code to display a message similar to the following:

    The MS-DOS 5.0 Setup was not completed.
    Insert the UNINSTALL #1 diskette in drive A.
    Press the ENTER key to continue.

This message should be erased and the master boot code rewritten before Setup is completed. If a problem occurs during Setup and you return to the previous version of MS-DOS, UNINSTALL should also remove this message. However, if Setup or UNINSTALL fails to remove this message, or if the master boot record becomes corrupted, a new master boot record can be written to the disk using the following command:

    C:\>FDISK /MBR


/Q Prevents rebooting the computer automatically after altering the partition information by using FDISK with other parameters.

    [MS-DOS 6.00 and above ONLY]

/STATUS Displays a screen similar to using FDISK's option 4: "Partition information", but shows also extended partition information (if any).

    [MS-DOS 5.00 and above ONLY]

/X Limits disk access to a total of 8.4 GB even on larger physical drives, even if the BIOS supports INT13h extensions for hard disks over 8.4 GB, thus preventing the use of 0E and 0F partition types, by ignoring LBA (Logical Block Addressing) and extended disk information. This makes possible disk partitioning on computers with older BIOSes without support for hard disks larger than 8.4 GB. Use /X to start FDISK if you receive disk access, stack overflow and/or data corruption error messages.

    [Windows 95 + MS-DOS 7.00 and above ONLY]

/ACTOK Skips disk integrity checking, thus speeding up the partitioning process.

    [Windows 95B OSR 2.0 + MS-DOS 7.10 and above ONLY]

/CMBR x /CMBR x MUST be used together for proper operation. Recreates the boot sector of the second, third... etc hard disk(s) (if any) overwriting it (them) with a fresh copy, by writing a new Master Boot Record (MBR) based on existent disk structure, without altering the partition table information.
Valid values for x are;

1 = first (bootable) physical hard disk (same as using FDISK /MBR):FDISK /CMBR 1
   2 = second (not bootable) physical hard disk (if any):FDISK /CMBR 2
   3 = third (not bootable) physical hard disk (if any):FDISK /CMBR 3
   ... etc.

Can be used to repair a damaged/corrupted MBR (i.e. by a virus).

See the Warnings about /MBR

    [MS-DOS 6.00 and above ONLY]

/PARTN Saves the partition information to a plain text file called PARTSAV.FIL, which can be viewed afterwards using any text editor/viewer, like EDIT.COM in DOS or Notepad in Windows.

    [MS-DOS 6.00 and above ONLY]

/PRMT adds extra prompt ["nag"] screens which require user input (key press) before proceeding further.

    [MS-DOS 6.00 and above ONLY]

 
Format    The disk formatting utility.
Please NOTC: These command switches are book marked.  Just click on the command switch to jump to that section.
   format [drivC:] [/AUTOTEST] [/BACKUP] [/SELECT] [/U] [/SELECT /U] [/Z:n]
/AUTOTEST Checks the existing format of your disk, unless the /U (UNCONDITIONAL parameter is also used [MS-DOS 5.00 and above ONLY], and then proceeds with an UNATTENDED DISK(ETTE) FORMAT:

    DOES NOT prompt for a volume label!
    DOES NOT prompt to format another disk(ette)!
    Ends WITHOUT pausing!
    after completion, it DOES display disk space statistics

 Use CAUTION: This works on BOTH hard and floppy drives!

    [MS-DOS 5.00 and above ONLY]

/BACKUP Works exactly like /AUTOTEST, applies ONLY to floppy diskettes, but it DOES prompt the user for a volume label, and it DOES display disk space information upon completion.

    [MS-DOS 5.00 and above ONLY]

/SELECT Similar to using the MIRROR command [a MS-DOS 5.00 and earlier ONLY utility, removed from all MS-DOS releases beginning with 6.00], and reads the disk(ette) system area (sector 0). In MS-DOS 4.0 FORMAT /SELECT has the same effect as FORMAT /BACKUP.

    [MS-DOS 5.00 and above ONLY]

/U Performs an UNCONDITIONAL format, which DESTROYS every byte of data on ANY hard disk/floppy by overwriting it with zeroes (hex F6h).
CAUTION: ANY disk(ette) formatted using /U can NOT be UNFORMATTED!

    [MS-DOS 5.00 and above ONLY]

/SELECT /U NEVER use these two FORMAT switches TOGETHER on ANY drive! The drive WILL become unusable.
FORMAT [drivC:] /SELECT /U makes a disk(ette) UNREADABLE by filling the system area (sector 0) with zeroes (hex F6h), due to using these two incompatible options together. All other sectors are left intact.

    [MS-DOS 5.00 and above ONLY]

/Z:n Formats a FAT32 drive with a cluster size of n times 512 Bytes.
Meanings:

    [drivC:] = your hard drive letter: C:, D:, C:... etc.
    n = number of sectors per cluster multiplied by 512 (cluster size in Bytes).

      Examples:

        n = 1 creates a  cluster of 512 Bytes
           n = 2 creates a cluster of 1024 Bytes

CAUTION: It's recommended that you do not change the default cluster size.  Some programs such as disk-repair or anti-virus tools may STOP working properly if you do!

    [Windows 95B OSR 2.0 + MS-DOS 7.10 and above ONLY]

 
Scandisk disk repair program
To check and repair a drive, use the following syntax

SCANDISK [drivC: | drivC:\DRVSPACE.nnn]

DrivC: Drive to check
drivC:\DRVSPACE.nnn The unmounted drivespace drive to check. This is the only way to check an unmounted drivespace in Windows.
None Checks and repair the current drive
/All Checks and repairs all local drives.
/Autofix Fixes damage without prompting.
/Checkonly Checks a drive, but does not repair any damage.
/Custom Configures and runs ScanDisk according to SCANDISK.INI settings.
/Nosave With /AUTOFIX, deletes lost clusters rather than saving as files.
/Nosummary With /CHECKONLY or /AUTOFIX, prevents ScanDisk from stopping at summary screens.
/Surface Performs a surface scan after other checks.
/Mono Configures ScanDisk for use with a monochrome display.
/Fragment [drivC:][path] filename Examine a file for fragmentation: Works in Windows
/Undo [drivC:] To undo repairs you made previously. Where [drivC:], specifes the drive containing your Undo disk.
/Time Monitor the average read, write, and seek times during surface analysis. This detects sectors that are about to go bad but can still be read. This is the same as ScanTimeOuts in scandisk.ini.
/Text Runs Scandisk as a MS-Dos prompt command. Can check but not fix problems.
/Help Displays command line help.
/Noui   


Why does Scandisk run at startup?

When Windows detects that it hasn't shut down properly it sets bit 4 of byte 8 in the File Allocation Table, if it detects a disk error it sets bit 3. Consequently Win.com will run Scandisk at the next boot.

By copying another file and calling it Scandisk.alt into the Windows\Command directory Win.com will execute this file instead.

Editing MSDos.sys in the root directory can control if Scandisk is run or not. The [Options] section should be there already, don't duplicate.

[Options]
Autoscan=2
0 Never
1 After prompting
2 Always.
 
Scandisk.Ini

See Scandisk.ini in the Windows\Command directory for customizing how Scandisk runs when started with the /custom switch. This is a fully commented file.

Click here for your Scandisk.ini (assumes you've installed Windows to C:\Windows
Choose OPEN when the dialogue pops up.

 
Scanreg the windows registry tool

Backs up, restores, and repairs the Windows registry from the DOS command prompt.
Backups are saved with names RBnnn.CAB, eg: RB001.CAB, RB002.CAB
There is also RBBAD.CAB which is the registry that won't boot.

scanreg [/Dir] [/Backup] [/Nop] [/Opt] [/Autorun] [/Restore] [/Help] [/?] [/Comment] [/Win][/Fix]
<nothing> Checks the registry and asks do you want to back it up.
RegistryFile The registry file to check.
/Dir Shows a UI with a test and cancel button.
/Backup Backs up the registry
/Nop Shows a UI without user input.
/Opt Optimises the registry by compacting it
/Autorun Windows Registry Checker automatically scans the system registry for invalid entries and empty data blocks when it is started. If invalid registry entries are detected, Windows Registry Checker automatically restores a previous day's backup. This is equivalent to running "scanreg /autorun" (without quotation marks) from a command prompt. If no backups are available, Windows Registry checker tries to make repairs to the registry. This is equivalent to running "scanreg /fix" (without quotation marks) from a command prompt. If the registry contains more than 500K of empty data blocks, Windows registry Checker automatically optimizes it.
/Restore Restores previously backed up
/Help Shows a subset of the command line switches
/? Shows a subset of the command line switches
"/Comment=Text" Adds a comment to a backup. This doesn't cause a backup to be created, but if one is created by another command line switch or the user choosing to backup then this comment will be added.
/Win

(from David Candy)

 Shows a UI, tests the registry and shows options to backup or restore the registry.

/Fix Repairs the registry and compacts the registry by completely rebuilding it.
 
Ver Retrieves the OS version information.
ver [/r] This is the only switch available for the ver command
None Retrieves the standard version information.
Example of screen output for plain VER command (using Win98 SE + MS-DOS 7.10)

    Windows 98 [Version 4.10.2222]

   
/r (REVISION) displays extended DOS info: the DOS revision and the memory location of the DOS module, in addition to using the plain VER command.  Example of screen output for VER /R command (using Win98 SE + MS-DOS 7.10):

    Windows 98 [Version 4.10.2222]
    Revision A
    DOS is in HMA

    [MS-DOS 5.00 and above ONLY]

 
Win (Win.com)  The Windows startup command. (Windows 95 and 98 versions only)
WIN [/W] [/WX] [/Z]
NOTC: Microsoft removed ALL WIN.COM undocumented switches detailed below from Windows ME and onwards!
/W Generates the following messagC:

    Press any key to continue...

Pressing a key reboots the system back to Windows 95 (98).
The system waits for user input (key press), and then restarts the computer (warm reboot), restoring the original CONFIG.SYS and AUTOEXEC.BAT files in the root directory of the boot drive from CONFIG.WOS and AUTOEXEC.WOS (if any).
This is useful when the computer is restarted after interrupting a "single" mode MS-DOS session, because of this CONFIG.SYS linC:

    DOS=SINGLE

which does NOT allow Windows 95/98 GUI to load.
This switch works ONLY if executed from the native/real/true MS-DOS mode OUTSIDE the Windows 95/98 GUI, NOT from WITHIN Windows in a DOS box/session.

NOTC:  The .WOS files are created when you run a DOS based program that requires a separate MS-DOS reboot setup (in "single" mode), and you have selected the "Specify a new MS-DOS configuration" check box in the PIF file Properties tab.


/WX Automatically restarts the computer (warm reboot), without prompting or waiting for input (key press), and restores the original CONFIG.SYS and AUTOEXEC.BAT files in the root directory of the boot drive from CONFIG.WOS and AUTOEXEC.WOS (if any).
This is useful when the computer is restarted after interrupting a "single" mode MS-DOS session, because of this CONFIG.SYS linC:

    DOS=SINGLE

which does NOT allow Windows 95/98 GUI to load.
This switch works ONLY if executed from the native/real/true MS-DOS mode OUTSIDE the Windows 95/98 GUI, NOT from WITHIN Windows in a DOS box/session.

NOTC:  The .WOS files are created when you run a DOS based program that requires a separate MS-DOS reboot setup (in "single" mode), and you have selected the "Specify a new MS-DOS configuration" check box in the PIF file Properties tab.

    [Windows 95 and above ONLY]

/Z Automatically forces the ATX power supply to (soft-)power off the computer ONLY on ATX motherboards, without prompting or waiting for input (key press).
This switch works ONLY if executed from the native/real/true MS-DOS mode OUTSIDE the Windows GUI, NOT from WITHIN Windows in a DOS prompt/box/session.

    [Windows 95B OSR 2.1 and above ONLY]

 
Winipcfg
Winipcfg is a DOS utility which can be used from MS-DOS or a MS-DOS shell (including Windows) to display the network settings currently assigned and given by a network. This command can be utilized to verify a network connection as well as to verify your network settings.
Winipcfg [/all] [/batch (file)] [/renew_all] [/release_all] [/renew n] [/release n]
nothing Starts with a User dialog to set the IP configuration.
/all Display detailed information - you get a button you can click without using this.
/batch (file) Write to file or /winipcfg.out
/renew_all Renew all adapters
/release_all Release all Adapters
/renew n Renew adapter n
/release n Release Adapter n