Windows Command Prompt

Published Date
01 - May - 2008
| Last Updated
01 - May - 2008
Windows Command Prompt

With Windows 2000 and then Windows XP, the use of the Windows Command prompt has been on the decline. Almost everything today is dependent on the user interface of Windows. There are still many tasks that can be done just from a Windows Command prompt and it can be handy for things like removing viruses or stubborn files that Windows Explorer can’t do anything about. The command prompt can be started by going to Start > Run, entering cmd and hitting [Enter].

Command Prompt History

In the DOS days when everything ran on command prompt, there was something called Doskey, which would keep a history of all the commands entered, which could be recalled as and when required. Windows has a better and easier way to display previously entered commands.

All previous commands can be access by a simple shortcut

Simply press [F7] and use the up and down arrow keys to select the command from the list you want to run again. You can also use the up and down arrows without the list, to cycle through the commands. To enter the previous command, type [F3]. If you want to enter a command line number from the list, press [F9] and enter it.

Command Prompt After Running Application

Many a times, a DOS or command line based program is run through the usual Start > Run method—say something like chkdsk or a network tracert command. The program executes and then shuts the command line window with it. Ideally, we want to see what happens during the execution of an application. To do this, type the name of the application or the command after cmd /k. For example, cmd /k chkdsk d: will scan the disk, display the results and leave the command prompt window open.

Copy And Paste

Most of us have, at some point or the other, tried to copy something from and into the command prompt window but the shortcuts [Ctrl] [C] and [Ctrl] [V] just wouldn’t work. To copy text from the command prompt, you need to first right-click on the title bar of the window and click on Mark. Now drag a box around the text you want to copy. Right-click again and the text will be copied into the clipboard. To paste any text into the command prompt window, right click in the window itself and click Paste.

the PROMPT command allows changes to be made to the command prompt

If you want to copy and paste stuff quickly, you can enable it by right clicking on the title bar for the window and then on Properties. Check the box for QuickEdit Mode. Click OK. You can choose to enable this for a single window or for all command prompt windows. Now simply drag and select the text to be copied. A single right-click will paste the contents of the clipboard to the window.

Using AutoComplete

Like the Linux console, Windows’s command prompt too has an auto complete feature, which allows you to complete file names without typing the entire name. Type the first few characters of the filename or folder and press [Tab]. If there is more than one result, you can use [Tab] to cycle through all the possibilities.

Full Screen Mode

If you try and run a console or DOS application that looks right when run on full screen, you can do it by pressing [Alt] [Enter]. Use the same shortcut again to get back to the window mode.

Customising The Command Prompt

The typical grey-on-black theme can get boring. There are a few changes that can be made to the command prompt to look a little friendlier. The prompt itself can be customised, which by default displays C:\ or the path you’re currently on.

the PROMPT command allows changes to be made to the command prompt

The prompt can be changed by typing PROMPT followed by the parameters. PROMPT $P$G will restore the prompt to the default one. Some of the parameters that can be used are as follows—
$D—Current date
$T—Current time
$V—Windows Version
$M—Network path for mapped drives

You can also have the text on the title bar changed. Enter the command TITLE in the command prompt, followed by the text you want to display on the title bar. For example, title %username% Úte% %time% will display the currently logged in user name followed by the current date and time.

If all this seems unnecessary, and you want a change of colour, the simplest way out is to right-click on the command prompt title bar and click on Properties. The fonts, colours and layout can be changed from here.

Open Command Prompt In A Specified Directory

The command prompt, when initialised, starts in the logged in users default directory—C:\Documents and Settings\Username. From there, you have to navigate using DOS commands to the respective directory, if you have to run an application or work on some files. If you want to launch the command line at a different location, first create a shortcut on your Desktop or your Quicklaunch folder by right clicking on it and clicking New > Shortcut. Enter the location of the item as C:\windows\system32 \cmd.exe. Give a name to the shortcut and click Finish create it. Right-click on the created shortcut and choose Properties. Click the Shortcut tab and enter the path where you want the command prompt to start. For example, C:\. Click OK. Double click the shortcut to run it.

Team DigitTeam Digit

All of us are better than one of us.