Customize Windows Command Prompt To Look Like A Bash Shell Prompt

I use both Linux and Windows Computers at work and have a need to use the command prompt on Windows. By default, Windows command prompt displays the current directory path. One problem with this is when you switch to a directory that has a long name, the prompt can end up half way across the screen. How can I change the prompt to look like a Bash shell prompt?

That is one drawback with Windows command prompt when the directory path name is long, the prompt ends up half way across the screen:

C:\Program Files\Microsoft Visual Studio\Common\IDE\IDE98>

With such a moving target that the command prompt can be at times, it can also be changed very easily by using the Prompt command.

The syntax for the Prompt command follows:

PROMPT [text]

where text specifies a new command prompt that can be made up of System and User variables, normal characters and the following special codes:

    * $A & (Ampersand)
    * $B | (pipe)
    * $C ( (Left parenthesis)
    * $D Current date
    * $E Escape code (ASCII code 27)
    * $F ) (Right parenthesis)
    * $G > (greater-than sign)
    * $H Backspace (erases previous character)
    * $L < (less-than sign)
    * $N Current driveprompt [%USERNAME%@%COMPUTERNAME%$S~]$$
    * $P Current drive and path
    * $Q = (equal sign)
    * $S (space)
    * $T Current time
    * $V Windows XP version number
    * $_ Carriage return and linefeed
    * $$ $ (dollar sign)

Say you wanted to make the prompt look like a Bash prompt on Ubuntu, Open a command prompt (go to Start \ Run… and type cmd then click OK) and enter the following Prompt command syntax:


Or you want the Prompt to look like a Bash prompt on Redhat Fedora:


If you wanted to return the Prompt back to the default setting, just enter:

Prompt $P$G

When changing the prompt at the command line, it is only valid during the session. Once you exit or quit the prompt will return to its default value. To make the change permanent, you will need to make a Registry change.

Before Proceeding – the next step includes exporting the registry key to use as a backup if needed. DO NOT SKIP THIS STEP. As a safe guard, you may want to create a System Restore point when making configuration changes to your System.

    * Open regedit
    * Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
    * Right click on Environment and select Export to back up the Key to a location on your Computer (you may also want to copy to a  CD or USB drive that can be accessed if needed)
    * In the right Window Pane, right click and select New \ String Value and name it PROMPT
    * Double click on Prompt and in the Value data: field type the syntax for the Command Prompt you wan to use (for example – [%USERNAME%@%COMPUTERNAME%$S~]$$)
    * Close regedit and either logoff or reboot

The next time you open the Command Prompt, you new prompt will always be set.

2 Responses

  1. andrew cooke says:

    hi, the discussion page on your mediawiki skin pointed here, although it seems odd to comment on an unrelated page. anyway, thanks for the skin. to get it working nicely on firefox running in an environment where the default colours are white on black i needed to add
    input, textarea {
    color: black;
    background: #eeeeee;
    i think this is because backgrounds for these elements don’t follow html/body settings and so you end up with black on black.

  2. Paul Gu says:

    Ok, that’s great!