Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to extend the windows cmd prompt, by prepending a string to the current prompt?

If I would use bash, I would write something like PS1="XXX $PS1"

Is there a similar possibility for the Windows command prompt?

share|improve this question

migrated from Dec 28 '12 at 13:46

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


The current prompt is stored, as you may have guessed, in the %PROMPT% environment variable. Using that in the prompt command will keep the existing prompt.

share|improve this answer



See also:

share|improve this answer
That does not preserve the current prompt, though. It appends the system default prompt to the string. What if the prompt has already been changed to something? – Soumya Dec 28 '12 at 12:08
Thank you, edited my answer. – utapyngo Dec 28 '12 at 12:11

I've solved it!

The prompt is also available using the environment variable PROMPT.

Hence I can do a


share|improve this answer
Did not I suggest the same? – utapyngo Dec 28 '12 at 13:55

Your Answer


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.