O'Reilly logo

Pro Windows PowerShell by Hristo Deshev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.4. Changing the Prompt Settings

All shells that I have seen, cmd.exe and UNIX shells included, have a mechanism to change the prompt string that gets displayed to the user before a command executes. Those shells allow users to configure the prompt by setting a global or an environment variable. For example, the cmd.exe default prompt has the $P$G value, where $P makes the shell print the current drive and path and $G prints the greater-than, or >, sign. The documentation lists several other options, all starting with a dollar sign, that one can use. UNIX shells, such as bash, offer a lot more options, but in essence, the approach is the same, including options and literal strings in a global variable. This approach has several disadvantages: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required