PowerShell prompt can be changed by calling
Function prompt{"new_prompt "}
and on the cmd prompt can be changed by calling
prompt $g$g$s
Once the current window is closed all the changes are gone and one will have to change them again when opening new instances of PowerShell or cmd. How can one make these changes permanent?
For PowerShell you'd put your custom Prompt() function in the relevant profile.
function Prompt {
"PS ${env:USERNAME}@${env:COMPUTERNAME} $(Get-Location)> "
}
For CMD you'd set/modify the PROMPT environment variable, e.g. via setx:
setx PROMPT "%"USERNAME"%"@"%"COMPUTERNAME"%"$s$m$p$g$s
You have profile where you can put initialization for your PowerShell command prompts.
Type $profile in your PowerShell command to see where it resides
Then modify it or create a new one if there doesn't exist one e.g. profile.ps1.
e.g. then add
function prompt { "PS " + $(get-date) ">"}
You can read more about profiles here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With