Hire a senior Perl / Python programmer today; download my up-to-date resume (PDF)
John Bokma Windows tips and tricks
freelance Perl programmer

Creating a customized Command Prompt shortcut

Short how to | 5 comments

Although the "Command Prompt here" shell extension often seems to make a short cut to a command prompt redundant, it can be quite useful to have one or even several at hand, especially since a shortcut can open a customized command prompt. I have several of those short cuts in my customized Quick Launch menu (see A better start menu with Quick Launch for how to create your own).

Creating the shortcut

Create a shortcut in a folder by pressing the right mouse button and selecting "Shortcut" from the "New" submenu. A dialog window pops up. Enter %COMSPEC% as the location of the item. If you are using the Quick Launch menu you might want to create this shortcut in a "Prompts" sub folder.

Creating a Command Prompt shortcut, step 1
Creating a Command Prompt shortcut, step 1

Next, enter a name for the shortcut and press Finish. The shortcut should be created.

Creating a Command Prompt shortcut, step 2
Creating a Command Prompt shortcut, step 2

Customizing the prompt

The next step is customizing the prompt. Select the shortcut, press the right (menu) mouse button, and select Properties. A dialog pops up with the Shortcut tab selected.

Setting the start (working) directory

With the Shortcut tab selected, enter a path in the "Start in" input line. There are several environment variables you can use to save some typing, for example %USERPROFILE% contains the path to the parent of your My Documents directory. Also you might want to enter something useful in the Comment input field.

Changing the start directory
Changing the start directory

Editing made easier

With the Options tab selected, turn QuickEdit mode on. This makes it easier to cut, copy and paste in your command prompt window.

Turning on QuickEdit mode
Turning on QuickEdit mode

Changing the font

With the Font tab selected, change the font to Lucida Console. I use a size of 10, which is quite small.

Changing font and size
Changing font and size

Changing the width and height of the window

With the Layout tab selected, change the widht and the height of the window to your preferences. Make sure that the width of the screen buffer is equal to that of the window, and the height of the buffer larger then the window height. The buffer height determines how many lines you can scroll "up" in your window. So if you expect your command line tools to generate a lot of output set the buffer height to a large enough value (or redirect the output to a file).

Changing the window and buffer size
Changing the window and buffer size

Changing colors

With the Colors tab selected, change the screen text and screen back ground colors. You can either select a predefined color, or edit the selected predefined color to your liking.

Changing the screen background color
Changing the screen background color

Other useful tips

With the TITLE command you can change the title of the command prompt window. With COLOR you can change the background and text color. COLOR expects two hexadecimal digits, the first is the background color index, the second the text color index. The colors are as given in the Colors tab (see above), with the left most color being 0 and the right most color being F. Note that if you edited a color, this color is used, not the original predefined one. If you edit the colors to more suitable ones, and use the TITLE command to assign a meaningful title, you can very easily visually distinguish between command prompt windows.

With START . you open the current directory in the Explorer, and START filename is the same as a double click on the filename.

Please post a comment | read 5 comments, latest by John Bokma | RSS feed