DOS commands

Graphical user interfaces, also known as GUI, have changed the way that people interact with computers, making them attractive to private users. Nowadays, most tasks on a computer can be fulfilled using the mouse – from opening programs to changing settings. In the early days, many of the same things were possible with DOS, using the keyboard instead of a mouse. Today it’s still useful to know certain DOS commands for worst-case scenarios. When the Windows graphic interface freezes, it’s often helpful to know how you can secure your data using DOS commands.

DOS commands with the Windows Command Prompt

In Windows, you can enter DOS commands using the Windows Command Prompt. The command line interpreter ‘cmd.exe’ uses Windows CMD commands that contain DOS commands. The command line interpreter also contains several – previously missing – features from the DOS interpreter COMMAND.COM.

There are two ways to open the Windows Command Prompt:

  1. Using the start menu: In Windows 7: All Programs > Accessories. In Windows 10: Start > Windows System > Command Prompt.
  2. Enter the command ‘cmd’ into the Windows search field. The Command Prompt will start automatically.

The most important DOS commands

Whether you want to copy a file, delete directories, or create a backup, there’s a DOS command that can help. We’ve compiled the most important DOS commands for you below:

DOS commands: Managing directories

Drive-letter: Combine the relevant letter with a colon to change between drives.Example: C: A:
CD Directory-name Changes to the directory you enter.For example: cd c:\windows
CD \ The DOS command ‘cd’ combined with a backslash will take you to the root directory of the current drive.
CD \files\photos Navigates to the root directory and from there to the directory ‘files\photos’.
CD .. Jumps up one level in the directory.
CD ..\files\photos Jumps up one level in the directory and from there into the directory ‘files\photos’.
DIR <Drive:\Path\to\directory Shows the whole contents of a directory. Filters (so-called ‘wild cards’) can be used to only display certain contents. An asterisk can be used as a placeholder for any number of characters. A question mark stands in for one character.For example:dir *.txtShows all files with the file extension ‘.txt’.dir dat*.txtShows all files with the extension ‘.txt’ whose names start with ‘dat’.dir dat1?.txtShows all files whose names consist of ‘dat1’, followed by one more character and the file extension ‘.txt’.dir /pLists the results page by page.dir /sAlso lists the contents of sub-directories.dir c:\dat*.txt /p /sLists all files on the drive C that start with ‘dat’ and end with ‘.txt’. Shows them page by page.
MD <Drive:\Path\to\directory The DOS command ‘md’ stands for ‘make directory’ and creates a directory on the indicated directory level. The system does not switch to the newly created directory.
RD <Drive:\Path\to\directory The DOS command ‘rd’ deletes the indicated directory. The directory needs to be empty. If you want the system to delete the directory together with its contents, you can use the DOS command DELTREE (in version 6 and above).
TREE <Drive:\Path\to\directory Shows all the sub-directories (with files) in the drive or directory indicated.

DOS commands: Manage files

ATTRIB <Drive:\Path\to\file You can use this DOS command to change an attribute of a file (for example, read-only mode).
COMP filename1 filename2 Compares two files with each other.
COPY <Drive:\Path\to\file <Drive:\Path\to\file Copies a file into a new directory. If you change the name of the file for the new directory, the system will duplicate it.Example: copy c:\files\photos\photo1.jpgThe system will copy the file ‘photo1.jpg’ from the directory ‘files\photos’ into the current directory.copy c:\files\photos\photo*.jpg a:\documents\photos\Copies every file whose name starts with ‘photo’ and ends with ‘.jpg’ into the indicated directory - in this case a directory on Drive A.copy file01.txt file02.txtCopies the contents of the file ‘file01’ into the file ‘file02’ and puts it in the same directory.copy file01.txt a:\documents\file02.txtCopies the file ‘file01’ onto a floppy disk and renames it as ‘file02’.copy *.txt *.docCopies all the files with the extension ‘.txt’ and changes the extension to ‘.doc’. The file names remain the same.
DEL <Drive:\Path\to\fileNote: ERASE is the same DOS command as DEL Deletes the file that you’ve indicated.
EDIT <Drive:\Path\to\fileNote: Before version 6, this DOS command was EDLIN Opens the DOS editor in order to edit the selected ASCII files.
FIND "String" <Drive:\Path\to\file Searches for a string of characters in the indicated file.
MORE <Drive:\Path\to\file Shows the contents of a file page by page. Convenient for viewing long files.
MOVE <Drive:\Path\to\file <Drive:\Path\to\new\directory Moves one or more files into the indicated directory.
PATH <Drive:\Searchpath Indicates a search path that the DOS should search through for executable files.
PRINT <Drive:\Path\to\file Prints the indicated file.
REN FilenameOld.txt FilenameNew.txt Renames one or more files. You can also use it to change extensions.Example:ren filename.txt *.docChanges the extension of the file from ‘.txt’ to ‘.doc’.ren *.txt *.docChanges all txt files into doc files.
REPLACE <Drive1:\Path\to\file <Drive2:\Path\to\file Replaces files in the target directory with files from the source directory.
SHARE Starts the program for file sharing and file locking.
TYPE <Drive:\Path\to\file Shows the contents of the indicated file on the screen.
UNDELETE <Drive:\Path\to\file Restores files that were deleted with DEL.
VERIFY onVERIFY off The options ‘on’ and ‘off’ determine whether DOS should check that write operations like copying were carried out without errors.
XCOPY <Drive:\Path\to\directory <Drive:\Path\to\new\directory This DOS command copies all files from one directory into another directory.

Other useful DOS commands

APPEND With this DOS command, you can open programs or files in the indicated directory as if they are located in the current directory.
ASSIGN Changes the letter of the drive indicated.Example:assign a=cChanges Drive A into Drive C.
BACKUPNote: In versions 6 and above, this DOS command is called MSBACKUP Secures one or more files in a drive.
BREAK This DOS command activates/deactivates additional monitoring of CTRL + C. If Break is turned on, CTRL + C will monitor additional features like read and write operations on disks.
CLS Clears the screen.
CHKDSK <Drive:\Path\to\file This DOS command creates a status report for the storage device indicated.
COMMAND Opens a new DOS command interpreter.
CTTY Changes the standard input and standard output device for operating the computer.
DATE mm-dd-yy Shows the current date. Can also be used to change the date.
DISKCOMP Compares the contents of two disks.
DISKCOPY This DOS command duplicates a disk.
ECHO Activates or deactivates the display of text for batch files.
EXIT Closes DOS/the Command Prompt.
FDISK Sets up a hard drive.
FORMAT Formats a disk for use with DOS.Example:format a:Formats a new floppy disk in Drive A with standard capacity.
HELP < DOS command Shows the help text for the DOS command indicated.
PROMPT Changes the appearance of the DOS Command Prompt.
RESTORE <Drive1: Drive2:\Path\to\restore Used for restoring data from a backup.Example:restore a: c:\documets\*.*Restores all backed-up files in Drive C in the folder ‘documents’.
TIME hh:mm:ss Shows the current time. You can also change the time using this DOS command.
SET Shows the settings of the DOS environment, with the option to change them.
VER Shows the DOS version number.
VOL <Drive: Shows the drive name and the serial number of the disk (if available).

Special keyboard commands on the DOS level

In addition to these DOS commands , there are also special keyboard commands similar to Windows shortcuts that work on the DOS level:

Ctrl + Alt + Del Restarts the computer
ESC Deletes the selection
F1 Repeats the last command character by character
F3 Repeats the last command
F5 Goes back one line
F6 Enters the traditional CTRL+Z (^Z) End-Of-File
F7 Displays command line history
Pause Stops screen output; output can be resumed with almost any key
Ctrl + C Aborts the line you are typing or the command that is executing. If you have text selected, it will not abort and instead will copy the text.
Ctrl + P Turns printer output on and off
Ctrl + PrintScr Prints the currently displayed screen
Ctrl + S Stops screen display
Ctrl + Break Aborts a command
In order to provide you with the best online experience this website uses cookies. By using our website, you agree to our use of cookies. More Info.
Manage cookies