DOS Command Reference
   
HOME
 
 

Here are some of the commands that you may commonly need to use. The list does not cover all of the DOS commands but you can download the help file at the bottom of the page.

[01] Attrib command
[02] Change Directory (CD)
[03] CHKDSK
[04] CLS (Clear Screen)
[05] Config.sys commands
[06] Copy
[07] Date
[08] Del / erase
[09] FDISK
[10] Format
[11] Make Directory (MD)
[12] MEM
[13] MORE
[14] Path
[15] Type
[16] XCOPY
[17] Download the help file

 

ATTRIB

 

Displays or changes file attributes. This command displays, sets, or removes the Read-only, Archive, System, and Hidden attributes assigned to files or directories.

Syntax: ATTRIB [+R|-R] [+A|-A] [+S|-S] [+H|-H] [[drive:] [path]filename] [/S]

To display all attributes of all files in the current directory, use the following syntax:

ATTRIB Parameter [drive:][path]filename Specifies the location and name of the file(s) you want to process.

Switches
+R Sets the Read-only file attribute.
-R Clears the Read-only file attribute.
+A Sets the Archive file attribute.
-A Clears the Archive file attribute.
+S Sets the file as a System file.
-S Clears the System file attribute.
+H Sets the file as a Hidden file.
-H Clears the Hidden file attribute.
/S Processes files in the current directory and all of its sub-directories

 

CHDIR (CD)

 

Displays the name of the current directory or changes the current directory.

Syntax CHDIR [drive:][path] CHDIR[..] CD [drive:][path] CD[..]

To display the current drive letter and directory name, use either of the following syntax lines:

CHDIR CD Parameters [drive:][path]
Specifies the drive (if other than the current drive) and directory to which you want to change. .. Specifies that you want to change to the parent directory.

 

 

CHKDSK

 

Checks the status of a disk and displays a status report. Can also fix disk errors.

The status report shows errors found in the MS-DOS filing system, which consists of the file allocation table and directories. CHKDSK also displays a summary of disk usage. (CHKDSK does not verify that the information in your files can be accurately read.) If errors exist on the disk, CHKDSK alerts you with a message.

Syntax CHKDSK [drive:][[path]filename] [/F] [/V]

To display the status of the disk in the current drive, use the following syntax:

CHKDSK Parameters
drive: Specifies the drive that contains the disk that you want CHKDSK to check.
[path]filename Specifies the location and name of a file or set of files that you want CHKDSK to check for fragmentation. You can use wildcards (* and ?) to specify multiple files.
Switches /F Fixes errors on the disk. Do not use this option when running CHKDSK from other programs;

 

 

CLS

 

Clears the screen. The cleared screen shows only the command prompt and cursor.

Syntax CLS

 

 
CONFIG.SYS Commands
 

The CONFIG.SYS file is a text file that contains special commands. These commands configure your computer's hardware components so that MS-DOS and applications can use them. When MS-DOS starts, it carries out the commands in the CONFIG.SYS file. Typically, the CONFIG.SYS file is located in the root directory of drive C.

CONFIG.SYS commands
Special characters in the CONFIG.SYS file The CONFIG.SYS file can also contain the following special characters:
;
Specifies that the current line is a descriptive comment and should not be carried out. Insert this character at the beginning of the line. (You can also insert a comment by using the REM command.)
? Specifies that MS-DOS is to ask for confirmation before carrying out the current command. Insert this character immediately after the command you want to prompt for, without any intervening spaces, but before the equal sign (=).

Given that the .sys file is hardly ever use, there is no need to dwell much on it, however, to have a complete reference of the command you can download the whole help file.

 

 
COPY
 

Copies one or more files to the location you specify. This command can also be used to combine files. When more than one file is copied, MS-DOS displays each filename as the file is copied.

Syntax COPY [/Y|/-Y] [/A|/B] source [/A|/B] [+ source [/A|/B] [+ ...]][destination [/A|/B]] [/V]

Parameters
source Specifies the location and name of a file or set of files from which you want to copy. Source can consist of a drive letter and colon, a directory name, a filename, or a combination.

Destination Specifies the location and name of a file or set of files to which you want to copy. Destination can consist of a drive letter and colon, a dir

Switches
/Y Indicates that you want COPY to replace existing file(s) without prompting you for confirmation. By default, if you specify an existing file as the destination file, COPY will ask you if you want to overwrite the existing file. (Previous versions of MS-DOS would simply replace the existing file.) If the COPY command is part of a batch file, COPY will behave as in previous versions. Specifying this switch overrides all defaults and the current setting of the COPYCMD environment variable.

/-Y Indicates that you want COPY to prompt you for confirmation when replacing an existing file. Specifying this switch overrides all defaults and the current setting of the COPYCMD environment variable.

/A Indicates an ASCII text file. When the /A switch precedes the list of filenames on the command line, it applies to all files whose names follow the /A switch, until COPY encounters a /B switch, in which case the /B switch applies to the file whose name precedes the /B switch. When the /A switch follows a filename, it applies to the file whose name precedes the /A switch and to all files whose names follow the /A switch, until COPY encounters a /B switch, in which case the /B switch applies to the file whose name precedes the /B switch. An ASCII text file can use an end-of-file character (CTRL+Z) to indicate the end of the file. When combining files, COPY treats files as ASCII text files by default. /B Indicates a binary file. When the /B switch precedes the list of filenames on the command line, it applies to all files whose names follow the /B switch, until COPY encounters an /A switch, in which case the /A switch applies to the file whose name precedes the /A switch. When the /B switch follows a filename, it applies to the file whose name precedes the /B switch and to all files whose names follow the /B switch, until COPY encounters an /A switch, in which case the /A switch applies to the file whose name precedes the /A switch. The /B switch specifies that the command interpreter is to read the number of bytes specified by the file size in the directory. The /B switch is the default value for COPY unless COPY is combining files.

/V Verifies that new files are written correctly. Related Command directory name, a filename, or a combination.

 

 
DATE
 

Displays the date and prompts you to change the date if necessary. MS-DOS records the current date for each file you create or change; this date is listed next to the filename in the directory.

Syntax DATE [mm-dd-yyyy]

Parameter
mm-dd-yyyy Sets the date you specify. Values for day, month, and year must be separated by periods (.), hyphens (-), or slash marks (/). The date format depends on the COUNTRY setting you are using.

 

 
DEL (Erase)
 

Deletes the files you specify.

Syntax DEL [drive:][path]filename [/P] ERASE [drive:][path]filename [/P]

Parameter
[drive:][path]filename
Specifies the location and name of the file or set of files you want to delete.

Switch
/P Prompts you for confirmation before deleting the specified file.

 

 
FDISK
 


Starts the Fdisk program, which configures a hard disk for use with MS-DOS. Fdisk displays a series of menus to help you partition your hard disk(s).
Syntax To start the Fdisk program, use the following

syntax: FDISK

To display partition information without starting the Fdisk program, use the following

syntax: FDISK /STATUS

Switch
/STATUS Displays an overview of the partition information of your computer's hard disk(s), without starting the Fdisk program.

 

 
FORMAT
 


Formats a disk for use with MS-DOS. The FORMAT command creates a new root directory and file allocation table for the disk. It can also check for bad areas on the disk, and it can delete all data on the disk. In order for MS-DOS to be able to use a new disk, you must first use this command to format the disk.

Syntax FORMAT drive: [/V[:label]]

Parameter
drive: Specifies the drive containing the disk you want to format. You must specify a drive parameter. If you do not specify any of the following switches, FORMAT uses the drive type to determine the default format for the disk.

Switches
/V:label Specifies the volume label. A volume label identifies the disk and can be a maximum of 11 characters. If you omit the /V switch or use it without specifying a volume label, MS-DOS prompts you for the volume label after the formatting is completed. If you format more than one disk by using one FORMAT command, all of the disks will be given the same volume label.

/Q Specifies a quick format of a disk. With this switch, FORMAT deletes the file allocation table (FAT) and the root directory of a previously formatted disk, but does not scan the disk for bad areas.

/U Specifies an unconditional format of a disk. Unconditional formatting destroys all existing data on a disk and prevents you from later "unformatting" the disk.

/F:size Specifies the size of the floppy disk to format.

/B Reserves space for the system files IO.SYS and MSDOS.SYS (as hidden files) on a newly formatted disk.

/S Copies the operating system files IO.SYS, MSDOS.SYS, and COMMAND.COM from your system's startup drive to a newly formatted disk that you can use as a system disk.

 

 
MKDIR (MD)
 

Creates a directory (folder). You can use the MKDIR or MD command to create a multilevel directory structure.

Syntax MKDIR [drive:]path MD [drive:]path

Parameters
drive: Specifies the drive on which you want to create the new directory. Path Specifies the name and location of the new directory. The maximum length of any single path from the root directory to the new directory is 63 characters, including backslashes (\).

 

 
MEM
 

Displays the amount of used and free memory on your computer. You can use the MEM command to display information about allocated memory areas, free memory areas, and programs that are currently loaded into memory.

Syntax MEM [/CLASSIFY|/DEBUG|/FREE|/MODULE modulename] [/PAGE]

MEM /CLASSIFY - summarizes overall memory use and lists the largest free memory blocks. You can use the /CLASSIFY switch with /PAGE but not with other MEM switches.

MEM /DEBUG - shows each module's size, segment address, and module type, summarizes overall memory use, and displays other information useful for programming.

/FREE - Lists the free areas of conventional and upper memory. MEM /FREE shows the segment address and size of each free area of conventional memory, and shows the largest free upper memory block in each region of upper memory.

/MODULE programname - Shows how a program module is currently using memory. You must specify the program name after the /MODULE switch.

/PAGE - Pauses after each screen of output. This switch can be used with any of the other MEM switches.

 

 
MORE
 

Displays one screen of output at a time. The MORE command reads standard input from a pipe or redirected file and displays one screen of information at a time. This command is commonly used to view long files.

Syntax MORE < [drive:][path]filename command-name | MORE

Parameters
[drive:][path]filename - Specifies the location and name of a file that supplies data you want to display. command-name Specifies the command that supplies data you want to display.

 

 
PATH
 

Indicates which directories MS-DOS should search for executable files. MS-DOS uses the PATH command to search for executable files in the directories you specify. By default, the search path is the current directory only.

Syntax PATH [[drive:]path[;...]]

To display the current search path, use the following syntax: PATH To clear all search-path settings other than the default setting (the current directory), use the following syntax: PATH ;

Parameters
[drive:]path - Specifies a drive, directory, and any sub-directories to search.

; When used as the only parameter, clears all search-path settings and specifies that MS-DOS is to search only the current directory.

 

 
TYPE

Displays the contents of a text file. Use the TYPE command to view a text file without modifying it.

Syntax TYPE [drive:][path]filename

Parameter
[drive:][path]filename - Specifies the location and name of the file that you want to view.

 

 
XCOPY
 

Copies directories, their sub-directories, and files (except hidden and system files). With this command, you can copy all the files in a directory, including the files in the sub-directories of that directory.

Syntax XCOPY source [destination] [/Y|/-Y] [/A|/M] [/D:date] [/P] [/S] [/E] [/V] [/W]]

Parameters
source - Specifies the location and names of the files you want to copy. Source must include either a drive or a path. destination Specifies the destination of the files you want to copy. Destination can include a drive letter and colon, a directory name, a filename, or a combination.

Switches
/Y - Indicates that you want XCOPY to replace existing file(s) without prompting you for confirmation.

/-Y - Indicates that you want XCOPY to prompt you for confirmation when replacing an existing file. Specifying this switch overrides all defaults and the current setting of the COPYCMD environment variable.

/A Copies only source files that have their archive file attributes set. This switch does not modify the archive file attribute of the source file.

/D:date -Copies only source files modified on or after the specified date. Note that the format of date depends on the COUNTRY setting you are using.

/P Prompts you to confirm whether you want to create each destination file.

/S Copies directories and subdirectories, unless they are empty. If you omit this switch, XCOPY works within a single directory.

/E Copies any subdirectories, even if they are empty.

/V Verifies each file as it is written to the destination file to make sure that the destination files are identical to the source files.

/W Displays the following message and waits for your response before starting to copy files:

 

# download help file
 
 
WINDOWS OPERATING SYSTEMS
  
     DOS basics
    
 Windows 95
    
 Windows 98
    
 Tips and tricks
    
 Advanced windows
    
Ask Questions
    
 Microsoft site



feedback: [email protected]
copyright© 2001