3

In PowerShell console window the initial prompt is

C:\users\username

I could customize the prompt with the below:

function Prompt { "PS: "}

The prompt now becomes

PS: 

Without making change to the C:\Users\user\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 I intend to revert to the original prompt.

How to go about it?

1
  • 2
    function Prompt { "PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) " } Commented Feb 12, 2017 at 13:23

1 Answer 1

5

From the about_Prompt help file:

In Windows PowerShell 3.0, the built-in prompt function is:

function prompt  
{  
    "PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "  
}
Sign up to request clarification or add additional context in comments.

1 Comment

I see that with below method I could revert back to the original prompt without having to remember the long script.. function my_prompt = (Get-Command Prompt).scriptblockThen I could revoke the function my_prompt to revert to the original prompt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.