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.

As we all know, Windows command-line have the white-black color scheme. And we could use:

COLOR

command to change the colors of background and text.

But the command above will change the whole text in the command-line. E.g. the result of command is as follows:

COLOR 04

enter image description here

But I don't want this kind of color-scheme because that makes no difference with the original white-black one. It is hard to distinguish the command you input and the output of the command. What I want is something like this:

enter image description here

I want the color of command prompt is different with other text on the screen so that I can find the command I input easily. But I only get the solution on Linux. It uses:

export PS1=”\[\e[35;1m\][\u@\h: \W]\$\[\e[0m\] “

So my question is:

How can I change the color of command prompt like the above one on Windows?

Thanks very much.

Solution:

Following the prompt of @Luke I finally get the solution. Anyone who is interested in this topic please hit the two links below:

Color for the PROMPT (just the PROMPT proper) in cmd.exe and PowerShell? & http://gynvael.coldwind.pl/?id=130

It is "ANSI hack developped for the CMD.exe shell".

Wish that would be helpful for you.

share|improve this question

migrated from stackoverflow.com May 23 '12 at 9:17

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

1  
The native Windows command prompt is not this configurable; you'll have to use a 3rd party solution. –  Luke May 22 '12 at 2:08
    
@Luke Is there any existing 3rd party solution you know? –  cloud May 22 '12 at 2:35

1 Answer 1

up vote 2 down vote accepted
  1. Install ANSICON (source)

  2. Setup your command prompt via environment settings...

    • Click / press Start
    • type env
    • Click Edit environment variables for your account
    • Edit / Add a PROMPT variable

  3. More information on prompt options

  4. My own prompt...

    • $_$E[1;30;40m[$E[0;36;40m%computername% | %userdomain%\%username%$E[1;30;40m] $E[0;33;40m$M$_$E[35;40m$d$s$t$h$h$h$h$h$h$_$E[1;33;40m$p$_$E[1;30;40m$g $E[0;37;40m
    • $E - escape character
    • $E[...m - ANSI Color Sequence
    • $_ - New line
    • $d - Date
    • $t - Time
    • $h - Backspace (get rid of seconds and fractional seconds)
    • $p - Current Path
    • $m - Mount Path (if in a mounted drive)
    • $g - Greater than sign

share|improve this answer
    
That's really a great tool. Thanks. –  feihu Aug 29 at 9:41

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.