about_prompts.help - TOPIC about_Prompts SHORT DESCRIPTION...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 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 DocumentRight Arrow Icon
Sheet1 Page 2 The Default Prompt The default Windows PowerShell prompt is: PS> This prompt appears only when the prompt function generates an error or when the prompt function does not return a string or object. PS C:\> function prompt {$null}
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2010 for the course BUS fin taught by Professor Fez during the Spring '10 term at Valparaiso.

Page1 / 5

about_prompts.help - TOPIC about_Prompts SHORT DESCRIPTION...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online