Navigating DOS
For those who have never used a command line envornment, it can be a little confusing and frustraiting. But don't worry. It's still confusing and frustraiting for people who have been doing it for years. Start by using the DIR command.
DIR
At the C:\WINDOWS> prompt type DIR for "directory". A list of files should fly up the screen faster than you can read. When the prompt comes up again type DIR/P. This will allow the list to be read one page at a time. Hit enter a few times to get to the end of the list and back to the prompt. DIR is a program that reads scans the current directory and lists all the files. /P is called a switch. The P stands for "page" or "pause"(I can never find out which). When you type DIR/P you are passing /P to the program DIR as a Parameter. You can pass other parameters to DIR. Try typing DIR/W, this puts the file list in "wide" format. Now try this, DIR R*.*. This will display all the files that begin with the letter R. The "*.*" part of the parameter is called a wildcard. A wildcard tells the program that anything after the letter R does not matter. Try this one, DIR *.*EXE. This will display all the files with the .EXE extension.
DIR will display all the files, directories, file sizes, time and date or creation.
DIR|MORE will show you the list and prompt to continue. Similar to DIR/P.
DIR/B for bare or brief, shows only the filenames and their extensions.
8 Character Limits
In early systems there was an 8 character limit on file names and directory names. Directory names and file names also could not contain spaces. This scheme still plays a big role in navigating DOS. The standard Windows folder "Program Files" is called "PROGRA~1." The general rule is to count 6 characters in: "PROGRA" then add the ~ and a number. Since we may have multiple files or directories with similar names, we have numbers at the end of the 8 character name. The number is determined by which file or directory was created first. Since Program Files is a built-in directory it gets a 1. If you create a new directory called "Programs" the DOS name will be "PROGRA~2". To view the DOS names, use this command: DIR/X
In some Windows versions you can open a DOS prompt in specific directory by first navigating to it through Windows Explorer, then going to Start, Run, CMD or COMMAND. In most cases it will open the default PATH directory.
For a full list of DIR possibilities enter DIR/? at the command prompt.
Switches
In DIR you placed various slashes and letters after the commands. These are "switches" that modify the behavior of a command. Every command has a different set of switches. A "/A" may mean something for a command and something totally different for another. Sometimes a switch may be preceded by a - instead of a /, sometimes there is no special character at all. For each command look at the help file to see the list of valid switches. You may view the help file of any command by typing the command followed by /? or /HELP in older versions.
CD (This is what worked on my WinMe system cd\ then C:\>cd windows (no \)
C:\>CD progra~1
Now for a different command. Type in CD.. this should set the prompt to "C:\", meaning that you are now in the root directory C:, C:\WINDOWS is a sub-directory of C:. CD stands for "Change Directory", a program that allows you to move around the directory structure. The .. parameter you passed to program CD tells the program to move up one directory level. Now pass a different parameter, type CD C:\WINDOWS\DESKTOP . This will change your directory level to the Desktop folder. Type DIR/P and look at the file listing briefly. Now minimize the DOS window and look at your Windows Desktop. You should see all the same files. Most of the file extensions will be .LNK meaning that they are shortcuts. CD will allow you navigate through the whole directory structure. You may also look at floppy disks: CD A

sometimes B: also), or CDROMs: CD D

sometimes E

.
CD.. puts you in the parent directory(up one level)
CD. refers to the current directory
As stated in the DIR section there is an 8 character limit for directory names for many DOS systems. When using CD to move to a directory with a long name be sure to know the DOS name. Example:
CD progra~1 to go to "program files" if you are in the root of C:\, otherwise use CD C:\progra~1 from any other directory.
Using drive letters as commands
To switch from one drive to another simply type the drive letter. Example: D: or A:. For removable media(floppy, CDROM) you must have the media in the drive to move to it.
PATH
PATH sets a directory search order. This is useful in many respects. For example, if you are using a boot disk
you are running the DOS operating system from that disk and the more complex commands will only run if you specify the location. If you are at the A: prompt and want to run a command on C: you must type FIND C:\myfile to use the FIND command, or if you are in C: you would need to type A:\FIND C:\myfile. To make things easier, type PATH A:\ at the C:\ prompt. This way the operating system will know to access A: for all the commands.
Some installation programs(especially development environments) will add a line to the AUTOEXEC.BAT like PATH=%PATH%;C:\MSSQL7\BINN this allows programming bins to be accessed from anywhere on the drive.
DOSKEY
Type in DOSKEY at the prompt, the DOSKEY program is now loaded. DOSKEY keeps a history of all the commands you type in each session so you can reuse them without typing them in over and over again. You may view your history by hitting the Up-arrow on your keypad. DOSKEY is active in NT by default, but not in Win2K. Consitency is not one of Microsoft's strong points.
DEL
DEL is the Delete program in DOS. DEL allows you to delete files. For example, typing DEL TEMP.TMP will delete the file temp.tmp. Warning! Using the DEL command in DOS is not like deleting in Windows, there is no Recycle Bin, the files are gone. If you accidentally delete systems files, you are going to have some problems. Only delete files that you are sure about.
EDIT
At the command prompt type EDIT. The screen should turn blue with a menu bar at the top. This is the DOS EDIT program and it can come in handy. Click on the "File" menu then click "Exit". You should be back at the prompt. With EDIT you can view and alter just about any file on your system, even ones Windows will not allow you to. Warning! Altering system or program files in EDIT can have serious consequences. Make copies of any file you edit and work on the copy so the original remains intact incase you screw up. Believe me, making copies is much easier that reloading your operating system. This time EDIT TEST.TXT this will open the editor and create a text file called "test.txt". Type in some random text. For a moment stop using your mouse. Press <-Alt-> and then the Down-arrow on your key pad. This will dropdown the "File" menu. This is how navigation was done before the mouse. Learning how to use the keyboard for navigation can be useful something goes wrong with your computer or your mouse wont work. Save your work and exit the editor. In some early versions of DOS it was called "EDLIN." If EDIT doesn't work try EDLIN instead.
REN
REN is short for "rename" and is used to rename files. Warning! Renaming files is as bad as deleting or altering them. Renaming system files can cause errors since the files point to each other. Type in REN TEST.TXT TEST.DOC. This will rename the text file you just created as an MSWord Document. You may now open Word and edit the TEST file like any other Word file. Type REN TEST.DOC MYFILE.DOC. This renames the file as "myfile" but it is still an MSWord document.
TYPE
TYPE is a program that will show the contents of a file without opening it for editing. Try entering TYPE MYFILE.DOC and you should see the contents of the file you created earlier.
MORE
Earlier you learned how to use the /p switch with the DIR command. There is another device which allows you to view directories and file contents a page at a time: MORE. Use the previous command to demonstrate. at the prompt enter TYPE MYFILE.DOC |MORE and hit < enter >. If the file you selected it several pages long, DOS will display the first page and then at the bottom of the screen you will see --more--. DOS is waiting for you to continue. Hit < enter > and it will scroll through the next page.
EXIT
Type this at the prompt to close the current DOS session.
FIND
This is a very usefull tool for searching files for strings(text). If you have lost a file or renamed a file and cannot remember what the name was, you can use FIND to locate it. For example if your name is Joe and the missing file has your name in it, enter FIND "Joe" at the prompt. DOS will search the current directory for any file containing the string "Joe."
MD or MKDIR
Use this to create and name your own DOS/Windows directory.
MD test, creates a directory named "test"
RD or RMDIR
Use this to remove directories.
RD test
MOVE
Moves files from one location to another, as opposed to copying.
MOVE test.txt A:\, moves the file "test.txt" from the current directory to the A: drive.
COPY
Copies files.
COPY C:\myfile.txt A:\myfile.txt
XCOPY
"Extended" COPY. Copies files from one or more subdirectories. Slightly more powerful than COPY. XCOPY has all the same functions as COPY but these switches also available:
/D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]... Specifies a list of files containing strings. When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the directory obj or all files with the .obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file, assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/O Copies file ownership and ACL information.
/X Copies file audit settings (implies /O).