Trust Ontrack to recover your data

DOS Commands

A Few DOS Commands you Might Need

(For Windows 98/ME/2000/XP)

DOS commands are not often used these days, but PC repairers do have to have some knowledge of these when an older PC comes in for repair or an older PC is being recycled once fixed.


To view the contents of a directory use the DIR command. At a command prompt type DIR and press RETURN to see all the details of all the folders. If the directory structure is large use the switch /p to pause the display after each screen of information e.g. DIR /p.


The ATTRIB.EXE command is critical for working with three types of files in a DOS environment: hidden files, read-only files, and system files. By following the ATTRIB command with a filename; a plus or minus sign; and the letter S, H, or R, you can add or remove the hidden, read-only, and system attributes from a file.

For example, if you wanted to make every file in your current directory visible, you could use the command below to remove the hidden attribute:

ATTRIB *.* -h

If you wanted to hide a file that was presently visible, you'd enter the ATTRIB command followed by the file name, the plus sign, and an H. The syntax for working with system files and read-only files is identical. The only difference is that you must substitute the H (hidden) with either R (readonly) or S (system). You can also use multiple switches in conjunction with each other.


To display the attributes of a file named "work.txt": ATTRIB work.txt

To assign the Read-Only attribute to the file "work.txt": ATTRIB +R work.txt

To remove the System and Hidden attributes from "work.txt": ATTRIB -S -H work.txt

To hide the directory "c:\hide:" ATTRIB +H c:\hide

To hide the files (but not the directories) in the C:\ directory: ATTRIB +H c:*.*

Change Drives or return to the Drive Root

To change to the root directory (or to another drive) just type the drive letter at the command prompt e.g. C: or D: or A:


Use the this command to move between directories. If a directory called DOCS contains a sub directory called INFO that you want to access, just type at the command prompt CHDIR INFO.

A shortcut method to change to the directory immediately above the current directory allows you to enter the CHDIR command followed by two periods. For example, to change from the INFO directory to the DOCS directory enter


Enter CHDIR.. again to change to the next higher directory (in this case, the root directory C:/).


Although CHKDSK has never completely gone away, the often seen ScanDisk has overshadowed it. However, the CHKDSK command is the quickest and easiest way to see how much disk space is available and if there are any problems with a particular disk. Typing CHKDSK at the command prompt generates a quick report, but if you enter CHKDSK /F this command also repairs any errors that are found. To find out more about CHKDSK type CHKDSK /? and press RETURN. This produces a list of all the available syntax switches that can be used to obtain the required level of functionality.


The COPY command enables you to copy one or more files from one location to another. When typing this command use the /V switch which verifies that the files have been copied correctly. To find out more about this tool use the /? switch e.g. copy /?


If you've ever tried to delete a large directory structure from the DOS prompt, you know how tedious it can be. You must remove the contents of each subdirectory individually before you can erase the main directory. The DEL TREE command speeds things up by deleting a directory and everything in it, including sub directories and their contents.


If you've ever looked at the contents of your Windows CD, you probably know that all the files that make up Windows are stored in a compressed format within CAB files. If you need to replace a damaged Windows file, you can use the EXTRACT command to decompress the file you need.

You can acquire the various syntax's for the command by typing EXTRACT /?


The MEM command allows you to view modules and drivers currently loaded in memory. To use this command, simply enter MEM /C at the command prompt. You'll then see a detailed summary of the machine's memory usage. Remember that you're working in DOS mode, so you won't see anything related to how Windows is using memory unless you use the MEM command while Windows is running. Instead, you'll see how your boot disk is managing memory.


The SYS command allows you to make any floppy disk or hard disk bootable. For example, if you were working on a computer that had a hard drive with a boot sector destroyed by a virus, you could boot from your emergency repair floppy or CD and run the command SYS C: This would add the IO.SYS, MSDOD.SYS, and COMMAND.COM files to the damaged hard disk, making it bootable once again.

Keep in mind, though, that any time you use the SYS command on a disk, the boot files from the source disk (floppy, CD, or hard disk) will be copied to the target drive. So make sure that the target system is running the same operating system as the source disk. For example, you could use a repair disk created on a Windows 98 machine as the source disk for another Windows 98 machine, but you wouldn't want to use a Windows 98 repair disk as the source for a Windows ME or XP machine.


The XCOPY command works just like the COPY command, but there are some very useful switches that you can add to custom-tailor the copy process. For example, supplying the IS switch will tell XCOPY to copy the subdirectories, too. For a complete list of all of the switches available for use with XCOPY, enter the XCOPY /? command.


If you need to edit a file such as 'system.ini' you use the EDIT command. e.g. in the Windows folder (CD\Windows) you would type EDIT system.ini. This gives you a text only display of the file so that you can amend it.

Read more articles about PC repairs, Web design & SEO