3

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?

3 Answers 3

2

PROMPT "String %PROMPT%"

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.

2

Yes.

set "PROMPT=XXX %PROMPT%"

See also:

1
  • 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?
    – user34993
    Dec 28, 2012 at 12:08
0

I've solved it!

The prompt is also available using the environment variable PROMPT.

Hence I can do a

set PROMPT=XXX %PROMPT%

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .