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?

migrated from stackoverflow.com 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.




See also:

  • 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

I've solved it!

The prompt is also available using the environment variable PROMPT.

Hence I can do a


  • 1
    Did not I suggest the same? – utapyngo Dec 28 '12 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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