Configuring the Command Prompt Window

Posted by Shashank Krishna Monday, January 5, 2009


sharethis:

Configuring the Command Prompt Window
The interface to the command shell can be customized in a number of ways and these are discussed.
The default settings for the window that displays a command prompt can be changed to suit individual preferences. Among the properties that can be changed are those that affect the appearance such as window size, background and foreground color, and font style. Others that affect operation such as the editing mode and command history buffer can also be configured.

The command prompt properties dialog

Changing the settings for the command prompt can be done through the properties dialog box. This can be reached in the menu that is opened by left-clicking the icon in the left-top corner or by right-clicking anywhere in the title bar at the top of a command prompt window. In the menu that opens choose "Properties". Figures 1 and 2 show the procedure.

Fig. 1. Menu for command window Fig. 2. Entry for properties dialog
Menu for command window  Entry for properties dialog

The properties dialog box contains four tabs. Each of these is discussed below.

Options tabOptions tab

The figure on the right shows the dialog box for the Options tab. Settings here include provision for configuring cursor size and window or full-screen display. The "Quick Edit" mode allows you to use the mouse to cut and paste text to and from the command window. You can also choose insert or overwriting for editing by checking or unchecking "Insert Mode".

Command History buffer

A new feature is the "Command History" buffer. This buffer stores the previous commands that you have entered so that you do not have to retype them (reminiscent of Doskey). The default value is 50 but can be made as large as 999 (remember that they do take RAM) . The up-and-down arrow keys can be used to navigate the previously entered commands. Alternatively, pressing the F7 key will display a pop-up window with a list of the commands.

Font tab

This tab is more or less self-explanatory. On most machines, there is a choice of two font faces, Raster (the default) and Lucinda Console. Lucinda Console is more versatile. A selection of font sizes is available. As is true in general about settings, changes in font can be made for the present window only or for all command windows with the same title.

Layout tab

The window size and position can be set here. There are also settings for the screen buffer size. This determines how many lines back that you can scroll.( Incidentally, this ability to scroll back to previous commands was not present in DOS. Once something was off the screen, you couldn't scroll back.)

Color tabColor tab

The dialog box for configuring colors is shown on the right. The default colors for a command window and its fonts are the old black and white combination. However, other color combinations are available. The colors for pop-up windows associated with the command window can also be configured. As shown in the figure on the right, colors can be changed by clicking on the appropriate choice or by entering numerical values in the 256 color RGB notation. In the figure, I have chosen a blue screen background with yellow screen text as illustration. Color changes can be made for the current screen only or applied to all command windows.

Screen colors can also be changed with the "color" command or a command-line switch directly modifying the command interpreter. Both these methods are discussed below.

It is also possible to have shortcuts that open the command line with more than one color scheme and this is discussed in the shortcut section below.

Apply changes to all command windowsApplying changes to all command windows

Note that changes apply to the current command window only unless you specify otherwise. When making configuration changes, you will be shown the dialog box on the right. To make changes stick after the current command session is closed, check the button by the entry, " Save properties for future windows with same title".

Properties sheet for command prompt shortcutConfiguring shortcuts for the command prompt

If you use the command prompt a great deal, you may want to place a shortcut on the desktop or in the Quick Launch bar. After creating the shortcut, you can configure the properties of the command window that it will open in much the same way as discussed above. Right-click the shortcut and choose "Properties" from the context menu. Four of the the tabs at the top of the properties sheet will be the same as those discussed above. They are marked in the figure on the right. You can apply whatever customization you like and it will apply only to command windows that are opened from this particular shortcut.


Apply shortcut propertiesAnother way to configure the properties of a particular shortcut is to apply the changes in a command window that has been opened with that shortcut. After configuring the changes to the open command window by the methods discussed in sections above, the dialog box shown on the right will open. Check the button by the entry, "Modify shortcut that started this window".

The "color" command

The screen colors can be configured from the command line itself with the command "color" followed by a two-digit hexadecimal number. The first digit determines the background and the second determines the text color. The table below shows the relationship between the hex numbers and colors.

Table I. Hexadecimal color codes
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White

For example the command "color 1E" will give a blue background with yellow text. Settings made this way apply only to the current session. Entering "color" with no argument will return the system to the starting colors.

Switches for the command interpreter cmd.exe

Another way to modify the behavior of the command prompt is to use switches with the command interpreter cmd.exe. The syntax for cmd.exe is:
cmd [[{/c|/k}] [/s] [/q] [/d] [{/a|/u}] [/t:fg] [/e:{on|off}] [/f:{on|off}] [/v:{on|off}] string]
Table II describes the parameters briefly. See the Windows Help and Support Center for more detail.

Table II. Switches for cmd.exe
Parameter Description
/c Carries out the command specified by string and then exits
/k Carries out the command specified by string and stays open
/s Modifies the treatment of string after/c or /k. See Windows Help for details
/q Turns the echo off. Default is echo on
/d Disables execution of AutoRun commands
/a Creates ANSI output (the default)
/u Creates Unicode output
/t:fg Sets the foreground f and background g colors. The hex codes for f and g are in Table I.
/e:on /e:off Enables or disables commands extensions. The default is "on"
/f:on /f:off Enables or disables file and directory name completion
/v:on /v:off Enables or disables delayed environment variable expansion
string Specifies the command you want to carry out



Share/Save/Bookmark
Subscribe

Spread Firefox Affiliate Button | edit post .

0 comments

Post a Comment

Are You Planning on Quitting Facebook? Why?

@Flickr

www.flickr.com

About Me

My Photo
Shashank Krishna
Bangalore, up, India
nothin much to say.........doin B.tech in IIIT allahabad loves bloggingn hacking.... :) and loooves blogging
View my complete profile

ads2

topads