9 February 2012

Windows Command Line



Command Line or Command Prompt is an interface in Windows that we are able to type a command and perform a specific task. Command Prompt in Windows act as a Disk Operating System (DOS) that you can enter DOS commands and execute them. DOS is an interpreter, which makes the interface between computer hardware and software.
Microsoft refers Windows Command Line as MS-DOS (Microsoft Disk Operating System), but you should know that Windows Command Prompt is not same as DOS. DOS is a 16 bit operating system and Command Prompt uses 32 bit coding. So Windows Command Prompt has more capability than old DOS. We can open multiple Command Prompt windows independently and even a Command Prompt inside another Command Prompt. To open Command Prompt in Windows, type CMD in Start Search box or Run. You can also open it from

Start>All Programs>Accessories>Command Prompt.

The cmd.exe file is located in Windows\System32 directory. 




To run Command Prompt with elevated privileges (Administrator privileges) go to

Start>Search>Command Prompt (or cmd)>Right-click>Run as administrator.




When you open Command Prompt, the first thing you see is the right angle bracket or greater than character (>) and it shows that the command line can accept commands.

C:\>

Before the greater than character, is the current working directory (in the example above C: drive) which indicates the command will be executed under the current working location (C:).

CMD Commands

In Windows Command Line you can run DOS commands and other Windows commands. If you are familiar with DOS commands, then you know that there are two types of commands in Disk Operating System:

Internal Commands and External Commands

Internal Commands are loaded into the system memory when the operating system loaded into the memory. For executing an Internal Command no external file is needed. These commands are built into the Windows Command Line. Internal Commands can only be run from the command line. Some examples of Internal Commands are:

copy, move, goto, date, dir, del etc.

External Commands are not a permanent part of the system memory and to run an External Command, an external file is needed. These commands can be run from the command prompt or Windows Run line. The reason that they are not included in the Windows Command Line (or not built into the Windows Command Line) is because they need large requirements (resources) or are not commonly used commands. Some examples of External Commands are:

append, format, net, ping, power, print, xcopy etc.

To see the complete list of commands in Windows Command Prompt, type help and press Enter





To see the command list page wise view, enter help more and hit the Enter.





And finally to see more details about a specific command enter

Help command-name

Or

Command-name /?

Example:

Help copy





Or

Copy /?







You can check Microsoft Command Line Reference in the link below: 

Microsoft Command Line Reference

With the Windows Command prompt, we are able to do many tasks like Disk management, Network management, creating batch files or Scripts. I will show you how to create batch files with Command Line later in other articles.