What is MS-DOS?
How to use MS-DOS
Basic MS-DOS Commands
What is MS-DOS?
MS-DOS is an operating system found on virtually all IBM PCs and compatibles since the beginning. It is a program that allows users (you, me, and the rest of the world) to run software (other programs) on that computer. Yet, it doesn't have a graphical interface like Windows. Programs are run by typing commands at a command prompt.
At this point, you may be wondering where MS-DOS is, if the system
we're using now is in no way like the operating system just described.
Well, you may be in for a surprise. Windows 3.1, Windows 95, and
Windows 98 all run on top of MS-DOS! So how do we get to MS-DOS? The
next section gives the answer.
How to issue commands to MS-DOS
To get to MS-DOS in Windows 95/98, click on the Start button, point to Programs, then click on MS-DOS Prompt, which should be near the bottom. For users of Windows 3.1, just exit the Program Manager, and you will be transported into DOS.
Okay, let's start with the basics. The command prompt is where
you issue commands, and it looks somewhat like this.
C:\Windows>_
Let's dissect this. "C:" means that the current drive on which you can run programs is Drive C:, which is your primary hard disk drive. "Windows" means that the current directory is the Windows directory on the current drive, Drive C:. A directory, known in Windows as a folder, is merely an object which contains files. The blinking underscore character is the place where commands that you issue will appear. Let's try one command, the dir command.
dir
When you press the Enter key, a listing of files and directories will appear. These all belong to the Windows directory. Notice that a directory can contain both files and other directories! But the Windows directory has dozen of files, too many to fit in our screen. Let's see if we can view the listing one screen at a time.
dir /p
The "/p" is known as a parameter. Parameters allow you to specify on what the command will act. Each command has its own set of parameters. In this case, /p directs dir to show one page (hence, the "p") at a time. Here are some other parameters for dir.
You can even combine parameters. Try looking at the Windows directory using /w and /p.
dir /w /p
Now let's look at another one.
cd \
CD is the command to change the current directory. But what is that backslash ("\") doing there? The blackslash by itself represents the root, or highest level directory (the only directory which cannot be contained in any other directory). The result is now the following.
C:\>_
Now try the following
cd windows
This will instruct the CD command to change to the windows directory.
C:\WINDOWS>_
Another useful parameter for CD is the ".." string (two periods in a row) which tells CD to go "up" one directory level. Suppose you execute
cd ..
at the
C:\WINDOWS>prompt. You will get the following.
C:\>_
Going up one level means changing to the directory that contains the current directory. The string ".." means just that, the directory containing the current directory, also called the parent directory.
Now let's learn about wildcards. The best way is by example.
dir *.txt
This lets us look at everything in the current directory whose file ends in .txt
dir a*.exe
This produces a listing of all file in the current directory, whose names begin with "A" and whose file extension is .exe
Now that we've seen how to issue commands to MS-DOS, let's look at the most often used MS-DOS commands.
cd directory_name
Changes the current directory to the directory specified by directory_name
date
Shows the current date and allows you to change it.
del file_name
Deletes the specified file. Wildcards can be very useful with this command.
Examples:
del foo.txt del *.mp3 del *.*
NOTE: This command does NOT move a file into the Recycle Bin. Once deleted, the file CANNOT be recycled.
Also, be extremely careful when doing
del *.*because this command deletes all files in the current directory. This can be extremely dangerous, so please be careful.
deltree directory_name
Deletes all files and directories in the specified directory, as well as all files and directories in each of the directories in the specified directory, etc.
Ordinarily, deltree will ask for confirmation that you wish to delete the given directory and all of its contents. However, including the /y switch (parameter) will cause deltree to remove everything without asking you first.
dir [switches] [directory_name | file_name]
Produces a listing of the contents of directory_name, listing the file names, file sizes, file creation dates, and file creation times.
Examples:
dir /?- see all parameters
dir C:\Windows- see what's in the C:\Windows directory
dir "C:\My Documents" /w /p- see what's in the My Documents folder, in wide format, one screen at a time.
dir C:\windows\command- Looks at all files in the Command folder in the Windows folder.
mkdir directory_name
Creates a new directory with the specified name, which will reside in the current directory
rmdir directory_name
Removes the specified directory from the current directory.
time
Shows the current time and allows you to change it.