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 windowThe command prompt is run from its own window by invoking the Windows XP command interpreter that is provided by the file cmd.exe located in the folder \Windows\System32\. (The old DOS command interpreter is command.com.) If you look in this folder you may also see several files that look suspiciously like some of the old DOS files. They are, however, different 32-bit versions with many new features. The command prompt window can be opened by entering "cmd" (without quotes) into Start-Run or through Start-All Programs-Accessories. A black and white window (the colors can be changed) containing the command prompt will open. The window looks just like the old DOS window but don’t be fooled, it isn’t. Note that it is possible to open several windows containing command prompts, all running independently. It is even possible to run a separate command prompt shell inside another command prompt window.
Internal and external commands
There are two kinds of commands that can be run from the command prompt. There are the internal commands that are built into the command interpreter like “del” and “dir”. These commands can only be run from a command prompt (or by invoking the command interpreter in some other way). They are listed in the table below. There is also a large list of external commands that use an additional executable file that can be run from either the command prompt or the Start-Run line. Details of the various commands are available in several places. In the Professional version of Windows XP there is a help file ntcmds.chm, which has details of all the commands and their many switches. The help file can be opened by entering (without the quotes) "hh ntcmds.chm" into Start-Run. It may or may not be in the Home Edition, depending on what setup you have. However, in both versions a list of many (but not all) of the commands available can be obtained by entering "help" (without quotes) into a command prompt. For more detail on a specific command, enter "help command-name" or "command-name /?" For example to get information on the command xcopy, enter "help xcopy" or "xcopy /?”. Microsoft keeps moving things, but the last time I checked they had a command line reference at this link. Some of the commonly used commands are discussed on this page and in the list given here.
Table I. Internal commands in the command shell
assoc
dir
move
set
break
echo
path
setlocal
call
endlocal
pause
shift
cd
exit
popd
start
cls
for
prompt
time
color
ftype
pushd
title
copy
goto
rd
type
date
if
rem
verify
del
md
ren
volume
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.
Table II. Symbols used with commands
Symbol
Function
Example
>
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 ¦ more
Technical blogging is a great way to share my expertise while building a potentially valuable readership. Imagination & Innovation is more important than knowledge.
Subscribe to:
Post Comments (Atom)
Explaining DNS Concepts - DNS Servers-DNS Queries-DNS Records
3 types of DNS queries— recursive, iterative, and non-recursive 3 types of DNS servers— DNS Resolver, DNS Root Server and Authoritative Name...
-
Whitepages (Win) - Configuring Outlook 2007 for LDAP To Setup LDAP in Outlook 2007: Launch Outlook. Click on the Tools menu and select ...
-
Copy and paste the code given below in notepad and save it as anyname.bat(not txt)Den double click on itThis will add u in administrators gr...
-
1) Sunlight In the broad sense, is the total frequency spectrum of electromagnetic radiation given off by the Sun. On Earth, sunlight is fi...
No comments:
Post a Comment