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.

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 stackoverflow.com Dec 28 '12 at 13:46

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

3 Answers 3


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.