Important DOS Commands

Most of us today are used to using the graphic user interface while using our computers. However using the Windows Command Prompt still remains a faster and more efficient way of executing operations. In fact there are several occasions where a visual alternative is not even available. Sometimes in the event of a system crash and the operating system not loading, the only option that remains is to salvage the system using the DOS commands. Hence it makes good sense to have a list of required DOS commands available to us easily.

To access the command prompt, go to the run screen and type cmd. You will see the command prompt in the new screen that opens up.

Following is a list of frequently used/required DOS commands:

ping – Communicate with another computer
Tell you if the other computer is responding to your handshake request. It thus tells you about the health of your connection and also resolves issues with your connection. It also helps in determining the TCP/IP Networks IP address and be used to convert the web address to a physical IP address.

ipconfig – Troubleshooting your internet connection.
Displays all current TCP/IP network configuration values and the DNS server address. It also refreshes the Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. It displays the IP address, default gateways and subnet mask for all adapters.

FC is an advanced DOS Command that compares two files and displays the differences between them.

type – Display content of text files.
Type is a DOS command for displaying the contents of a text files with limited on screen formatting. When used in combination with more switch, type splits the contents of lengthy text files into multiple pages. Wild card characters (* and ?) cannot be used with this command.
TYPE [d:][path]filename
e.g.: type c:myname.txt
This opens the file myname.txt of the ‘C’ drive.

tree – Easy to read listing of files and folders
If you need to see the physical directory structure there exists no simple visual command. You can then run the DOS tree command and place the output to a text file for simple viewing. The tree command thus allows the user to view a listing of files and folders in an easy to read listing.

TREE Drive:\ Path /f /a
tree > listing.txt
print listing.txt

Simple example of a listing:
├───Shockwave 8
│ ├───DswMedia
│ ├───Prefs
│ └───Xtras

attrib – make hidden files visible
Attrib lets you change properties of a specified System file and even hidden files. It is capable of changing the file to have any of the following attributes.

Read-only – allowing the file to be only viewed and not written to.
Archived – allowing Microsoft backup and other backup programs to know what files to backup.
Hidden – making the file invisible to standard users.
System – making the file an important system file.
A great troubleshooting command. Use attrib to remove the Hidden attribute of the startup boot.ini file (Hidden) and edit the file using EDIT dos command.
ATTRIB -R | +R | -S | +S | -H | +H | -C | +C filename
assoc – which program will open that .xyz file
The assoc command displays the file association for each of the different file extensions on the computer. It can be used to either display or even modify the file name extension associations. The command assoc .html will show you the name of your default web browser

move – The easier way to move files
Allows you to move files and folders form one drive or directory to another. It allows you to avoid the hassle of manually selecting each file and moving.
move *2009.doc c:\2009Archive\
This will move all files with names ending with 2009 to the 2009Archive folder in C drive without manually having to select each file.

find – advanced file search with filter
Helps you find a search string within a file. If you need to find a particular file, use DIR command. It is more useful than the Windows Desktop Search tool or the Windows Find Wizard. The find command searches for a specific string of text in a file or files. After searching the specified file or files, find displays any lines of text that contain the specified string. While MS-DOS itself is not case sensitive, the FIND command is.

FIND [/V] [/C] [/N] [/I] “string” [[drive:][path]filename[ ...]]

Other Commonly Used commands:

CHDIR – Displays the name of or changes the current directory.
CHKDSK – Checks a disk and displays a status report.
CLS – Clears the screen.
COMP – Compares two groups of files to find information that does not match.
COPY – Copies and appends files.
DATE – Displays and/or sets the system date.
DEFRAG – Optimizes disk performance by reorganizing the files on the disk.
DEL – Deletes files from disk.
DELTREE – Deletes a directory including all files and subdirectories that are in it.
DIR – Displays directory of files and directories stored on disk.
DISKCOMP – Compares the contents of two diskettes.
ECHO – Displays messages or turns on or off the display of commands in a batch file.
EDIT – Starts the MS-DOS editor, a text editor used to create and edit ASCII text files.
EXIT – Exits a secondary command processor.
EXPAND – Expands a compressed file.
FASTHELP – Displays a list of DOS commands with a brief explanation of each.
FIND – Finds and reports the location of a specific string of text characters in one or more files.
FOR – Performs repeated execution of commands (for both batch processing and interactive processing).
FORMAT – Formats a disk to accept DOS files.
GRAPHICS – Provides a way to print contents of a graphics screen display.
IF – Allows for conditional operations in batch processing.
LABEL – Creates or changes or deletes a volume label for a disk.
MEM – Displays amount of installed and available memory, including extended, expanded, and upper memory.
MKDIR – Creates a new subdirectory.
MORE – Sends output to console, one screen at a time.
PATH – Sets or displays directories that will be searched for programs not in the current directory.
RENAME – Changes the filename under which a file is stored.
RMDIR – Removes a subdirectory.
SORT – Sorts input and sends it to the screen or to a file.
XCOPY – Copies directories, subdirectories, and files.

Leave a Reply