VocExileMain Menu /MSDOS Prompt

The MSDOS Prompt

Some Useful Things You Can Do With It

By Ed Perley

Introduction

Before there was Windows, there was MSDOS. It began rather modestly as merely a disk operating system for managing program and data files on floppy disks. Installation of hard drives and the explosion of new periphrials led to the addition of more sophisticated disk management programs in later versions. Backup programs were needed to save the increasingly large and complex applications and their data files to multiple floppy disks. Better programs for checking hard disk integrity and memory allocation were also called for.

By the time it was replaced by Windows95, MSDOS had gone through six major revisions. It's numerous commands and features are still available to Windows users. Many disk maintenance operations are more easiy accomplished using the collection of powerful MSDOS commands provided.


Accessing MSDOS Commands

You can make MSDOS available to you in two ways: With Windows 95 and 98 you can access it through the shutdown sequence. One of the options given is to restart the computer in MSDOS mode. It will reboot the computer to come up in MSDOS mode. This is probably the best way to go if you want to run a program designed to run on MSDOS computers. Because Windows is turned off, there is less chance of memory conflicts between the two operating systems.

MSDOS can also be accessed from the Programs Menu, which you can access with the START button. Select the MSDOS Prompt icon. This creates an MSDOS window on the desktop, which can be expanded to make a full screen. The desktop can be accessed again by pressing the 'ALT' and 'TAB' keys together. This method of accessing MSDOS also works with the more recent versions of Windows.


The MSDOS Screen

You will quickly see that the MSDOS environment is much simpler than that of Windows. There are no icons or menus to click on. In fact, you can not use your mouse at all here. You have to enter commands at DOS prompt. It will look something like this:

C:\WINDOWS> _

This indicates that you are on the C drive in the WINDOWS folder. Except that here, folders are called directories, or more properly, subdirectories. Except for the terminology, the directory structure you will see is identical to that in Windows. This is roughly equivalent to using MY COMPUTER to be in the WINDOWS subfolder.


EXIT

The first command you will want to know is EXIT follewed by the 'ENTER' key. You always have to press 'ENTER' after typing an MSDOS command. If you got here using the MSDOS prompt program, this will immediately end the MSDOS session and return you to the Windows Desktop. If you used the Shut Down Menu to get to MSDOS, the computer will reboot, go back into Windows mode and show the desktop as before.


DOSKEY

DOSKEY is a simple line editor for the DOS prompt. Without it, the backspece key is the only editing key you can use. Simply enter DOSKEY. It stays active until you leave MSDOS. It allows you to use the left and right arrow keys to move left and right on the input line. The 'Delete' key also works now. The upper and lower arrow keys allow you to recall commands you entered earlier. You will quickly discover how DOSKEY makes MSDOS easier to use.


Using CD to Go to Another Subdirectory

Use CD to move to a different subdirectory. To back up from the WINDOWS subdirectory to the parent directory, you type:

CD ..

Remember to always leave a space between CD and any parameters (the pair of dots) following it. This next command will do the same thing:

CD C:\

Both of these commands tell MSDOS precisely how to get to the root, the one from which all other subdirectories on the disk are descended from. You can't back up further than this. The following commands will both return you to the WINDOWS subdirectory.

CD WINDOWS
CD C:\WINDOWS

The first line simply tells MSDOS to go to the WINDOWS subdirectory. The second line tells the computer precisely how to get to the WINDOWS subdirectory. The first line will work only if you are in a directory that is a direct parent of the subdirectory you want. Otherwise you will get a file not found error message. The second line will always work, even if you are currently located on a different disk drive.

Note the backslashes in some of the above commands. Backslashes are used to separate subdirectory names. Forward slashes are used for command parameters, which are shown below.

To get information about how a command works, type the command, followed by a space and '/?'. The resulting screen display will summarize syntex and how the command can be used.


Going to a Different Disk Drive

If you wish to work on another hard disk, floppy disk, or CDROM, enter the following commands. Enter the drive letter followed immediately (no space) with a colon after the letter.

This gets you to the A Drive:
A:

This gets you back to the C drive:
C:


Using DIR to List Files and Subdirectories

Use DIR to get a listing of files and subdirectories within a selected subdirectory. To get a listing from within the subdirectory you are currently in, type:

DIR

You will probably notice that two file names are given for each file. The one to the right is the Windows name, which can be any length. The other filename is the MSDOS name, which you need to use while you're in MSDOS mode. This name is necessary, because MSDOS puts much stricter limits on what a file name can be. An MSDOS file name contains only one period. Up to three characters can be put to the right of the period. To the left, up to eight characters can be placed. Any more letters than this will not be accepted. If the windows name has more than eight letters to the left of the period, the MSDOS name has a ~1 or ~2, etc. before the period, depending on how many files have the same first eight letters.

If there are so many files and/or directories that some scroll off of the screen, type in the following:

DIR /P

The display will stop scrolling after the page is full. You will be prompted at the bottom of the screen to press a key to display more of the directory.

To get a listing of file names only in a more compressed format, enter the following. This gives only the MSDOS file name for each file.

DIR /W
or
DIR /W /P

As with the 'CD' command, you can specify which subdirectory you wish to look at. Enter the following command to look at the contents of the WINDOWS subdirectory.

DIR C:\WINDOWS /W /P


WILD CARD SYMBOLS

The wild card symbols '*' and '?' are used by a number of MSDOS commands to specify file names that have something in common. They can be used in the parameters of a number of MSDOS commands. To get a listing of all files that end in '*.txt,' one screen at a time, type:

DIR *.TXT /P

To get a listing of all files that begin with 'A', type:

DIR A*.*
or
DIR A*

To get a listing of all files that begin with 'A' and have only four letters to the left of the period, type:

DIR A???.*

The following command redirects screen output to your default printer. This can be used to redirect screen ouput from any of these commands.

DIR > PRN


Using COPY and MOVE to Move Files

'COPY' and 'MOVE" are used to copy or move files from one place to another. They can use the same wild card characters that the DIR command uses. They can not be used to copy or move whole directories. The following command copies all files ending in '.TXT' from the current subdirectory to the 'TEXT' subdirectory:

COPY *.TXT C:\TEXT

This command moves all files with 'A' as the second letter into the '2A' subdirectory:

MOVE ?A??????.* C:\2A

To copy all files from the 'NEWTEXT' subdirectory to the 'OLDTEXT' subdirectory when you are currently in another directory, enter the following:

COPY C:\NEWTEXT *.* C:\OLDTEXT

WARNING!

If you try to copy or move multiple files to a subdirectory that does not exist, MSDOS will not create the subdirectory you specify. Instead it will copy all of the files into a new file with that name. If the files are text files, it is possible to separate these files (with Windows Cut & Paste) into their original files. If the files are non text, you are probably out of luck. You will have a large monster file that is completely useless. So be very careful. It is safer to use the 'COPY' command because the original files remain after being copied. You can always delete the original files after you are sure they have copied properly.


Using XCOPY for More Specialized Copying

This is a more powerful version of the COPY command. It allows you to copy files made after a certain date, or those with the archive attribute set. It can also be used to copy one or multiple directories from one place to another. The various uses of this command are too extensive to list here. Enter 'XCOPY /?' to get more information.


Usng REN to Rename Files

Use this command to rename a file. The command below will change a file name from 'NEWSTUFF.TXT' to 'OLDSTUFF.TXT':

REN NEWSTUFF.TXT OLDSTUFF.TXT


Using DEL to delete files

This command is used to delete files from your drive. It can also be used with wild cards. It does not actually erase files, but it does make their space available for new files. Deleted files are NOT sent to the Windows Recycle Bin. The command below deletes all files in the current directory that end in .bak:

DEL *.BAK


Using UNDELETE to Bring Back Accidently Deleted Files

If you accidently delete a file you did not want to, you can use this command to get it back. It is IMPORTANT that you do not do any file manipulations after the unwanted deletion. Otherwise the file might be overwritten. The deleted file name will have it's first character replaced by a question mark. This is how MSDOS recognizes deleted files that can be overwritten. In order to recover the file, you must enter the missing character to replace the question mark. Enter the command with the '/?' parameter to get more information on how it works.


Using MKDIR to Make New Subdirectories (Folders)

In order to copy files into subdirectories, you first must create subdirectories. The commands below will create a new subdirectory named 'STUFF' within the current subdirectory:

MKDIR STUFF

When you reenter Windows, you will find a new folder with the name 'STUFF' where you placed it.


Using RD to Remove Subdirectories

Use 'RD' to remove an subdirectory. Before a subdirectory can be removed, all files must be deleted or moved out. The command below will remove the subdirectory you just made.

RD STUFF


Batch Files

MSDOS Commands can be strung together to make simple programs. They are entered into a file using a text editor. The file is given the '.BAT' extender. The following batch file displays all of the cookie files presently in the
'C:\Windows\Cookies' directory, used by Internet Explorer. I placed it in a file called 'COOKIELOOK.BAT' The 'echo' command allows one to display text to the screen. 'CLS' clears the screen. 'REM' indicates a remark.

REM COOKIELOOK.BAT
REM SHOW LIST OF COOKIES
echo off
CLS
echo COOKIE LOOK
echo The following cookies are in the Cookies directory
DIR C:\WINDOWS\COOKIES\*.txt /P

The following batch file will move all cookies to a subdirectory called oldcookies, where they can not be accessed by their parent web sites. Make a subdirectory called 'OLDCOOKIES.' I placed it in a file called 'COOKIEKILLER.BAT'. When you get back to theWindows desktop, put short cuts to these batch files somewhere handy. Double Click their icons to run the batch files from Windows.

REM COOKIEKILLER.BAT
REM MOVE COOKIE FILES TO OLDCOOKIES FILE
echo off
CLS
echo COOKIE KILLER
echo Moves Cookies to C:\OLDCOOKIES file
MOVE C:\WINDOWS\COOKIES\*.TXT C:\OLDCOOKIES

There a number of other useful MSDOS commands. There are backup programs, disk scanners, memory check, etc. A good book on MSDOS will give more details.


To Main Menu


http://www.nfinity.com/~exile/progmenu.htm
Email: See Main Menu page
Date last updated: November 2005