Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On Linux, I can set the prompt to a custom color by typing:

export PS1="\[\e[36;1m\][\u@\h \W]\$ \[\e[0m\]"

Is there a way to customize the color of the prompt on Windows 7? I'm not refering to the general text color of the command window, but just the prompt itself.

share|improve this question

migrated from stackoverflow.com Dec 10 '12 at 18:47

This question came from our site for professional and enthusiast programmers.

    
As far as I know, no cmd.exe does not offer that, though that works just fine in PowerShell. –  vcsjones Dec 10 '12 at 16:30

1 Answer 1

The standard windows command prompt does not support colored output, and I am not aware of any way to change the properties of the prompt itself. Basic ANSI color escape characters can be made to work in the standard Windows command prompt by using ANSIcon, but I do not think the prompt itself can be changed.

You can easily change the prompt in powershell, however, by simply overriding the "prompt" function. A simple example:

#Replace default powershell prompt
function prompt
{
    Write-Host ("<" + $(pwd) + ">") -nonewline -foregroundcolor Blue
    return ' '
}

Produces a prompt consisting of the current directory in blue, like so:

Basic powershell blue prompt

Naturally you can add any other logic you would like to the prompt function.

share|improve this answer
    
Thanks for the tip on how to do it in powershell. –  KalenGi Dec 10 '12 at 23:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.