PowerShell: How to customize prompt?
I like to define the env variable PROMPT as $p$_$g so prompt starts in a new line.
But seems to be not applying to my PowerShell prompt :-(
dir function:/ shows that a name "prompt" is already defined.
Any way I can get my prompt customized in a PowerShell console, without messing up with the already defined "prompt" name?
Solution 1:
The prompt
function is just the default prompt supplied by Powershell. If you put a new prompt
function into your profile, it will overwrite the existing one - but if you remove the custom definition in your profile, the previous function will be used again.
Edit your profile with:
notepad $profile
Then add your custom prompt
function:
function prompt {
"$pwd
>"
}
Restart powershell and you will have your new prompt.
To revert, just edit $profile
again and remove the new function.