November 2018
Intermediate to advanced
566 pages
17h 15m
English
The prompt is controlled by a function called prompt. To demonstrate this, we could use the following:
PS> Get-Command prompt
The output shows that there is indeed such a command, which is of the Function type. To know the contents of the prompt function, enter the following:
PS> (Get-Command prompt).ScriptBlock
The output shows you the entire function you just wrote. This is, however, the function that overrode the default prompt function. If you clear your profile, restart the PowerShell session, and type in the preceding command; you would see a simple three-liner output, which is the default prompt function.
The function we wrote replaces the default script block with our custom code. Here is what you did:
First, you declare ...
Read now
Unlock full access