DOS is dead, long live the command line
Before proceeding further, I wish to clear up a common misconception that the command prompt in Windows XP is the same as DOS. Even some experts who know better sometimes refer to the command prompt as a DOS window. In fact, Microsoft itself isn't always careful about the distinction. There are some superficial resemblances and some commands with the same name but in fact the old 16-bit DOS is dead. All remnants of DOS are totally gone from the Windows XP kernel (there is a DOS emulator for legacy programs). Windows XP is a 32-bit protected memory system with a totally different approach from the DOS/9X/Me family. The command line in XP has many more capabilities and none of the 16-bit limitations like the restriction to the DOS 8.3 file name format. The augmented capabilities make the command line a powerful tool.
The command prompt window
Internal and external commands
Some symbols that are usedIn addition to the commands, there are several symbols that are used. These modify or combine the actions of commands. The table below gives a list.
|>||Sends output to a named file. If file does not exist, it creates one. Overwrites existing file||command > somefile|
|>>||Appends output to contents of a named file or creates a file if none exists||command >> somefile|
|<||Uses contents of a named file as input to a command||command < somefile|
|¦||Sends ("pipes") the output of command1 to the input of command2||command1 ¦ command2|
|&||Used to combine two commands. Executes command1 and then command2||command1 & command2|
|&&||A conditional combination. Executes command2 if command1 completes successfully||command1 && command2|
|¦¦||Command2 executes only if command1 does not complete successfully.||command1 ¦¦ command2|
|@||Used in batch files at the beginning of a line to turn off the display of commands||@echo off|
The most commonly used symbols are the two redirection symbols ">" and ">>" and the so-called pipe, "¦" . (Just to make sure there is no confusion, the "pipe" is the symbol above the back slash on most keyboards. On keyboards it has a break in the middle but the break does not always show when you type the symbol. A special code is used to show it on a Web page.)
A frequent use of the redirection is to save some output to a text file. For
example the command
dir somefolder > somefile.txtsends a list
of the files in "somefolder" to a text file "somefile.txt".
More about this type of use is on
this page. A common use of the "pipe" is to control the screen
display of some command with a lot of output. For example, if you want to check
the list of files in a folder with many files, you can display one full screen
at a time by piping to the command "more"
dir somefolder ¦