{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

about_prompts.help

about_prompts.help - TOPIC about_Prompts SHORT DESCRIPTION...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
TOPIC about_Prompts SHORT DESCRIPTION Describes the Prompt function and demonstrates how to create a custom Prompt function. LONG DESCRIPTION The Windows PowerShell command prompt indicates that Windows PowerShell is ready to run a command: PS C:\> The Windows PowerShell prompt is determined by the Prompt function. You can customize the prompt by creating your own Prompt function. Then, you can save this function in your Windows PowerShell profile. The Prompt Function The Prompt function determines the appearance of the Windows PowerShell prompt. Windows PowerShell comes with a built-in Prompt function, but you can override it by defining your own Prompt function. The Prompt function has the following syntax: function prompt { <function-body> } The Prompt function must return an object, typically a string. We recommend that it return a string or an object that is formatted as a string. The string should fit on an 80-character line. For example: PS C:\> function prompt {"Hello, World > "} Hello, World > Like all functions, the Prompt function is stored in the Function: drive. To display the code in the current Prompt function, type: (get-item function:prompt).definition This command uses the Get-Item cmdlet to display the Prompt item in the Function: drive. Then, it uses dot notation to display the value of the Definition property of the Prompt function.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}