Get-Host
The Get-Host cmdlet gets an object that represents the program that is hosting Windows PowerShell.
The default display includes the Windows PowerShell version number and the current region and language settings that the host is using, but the host object contains a wealth of information, including detailed information about the version of Windows PowerShell that is currently running and the current culture and UI culture of Windows PowerShell. You can also use this cmdlet to customize features of the host program user interface, such as the text and background colors.
Out-Host
Sends output to the command line.
The Out-Host cmdlet sends output to the Windows PowerShell host for display. The host displays the output at the command line. Because Out-Host is the default, you do not have to specify it unless you want to use its parameters to change the display.
Get-Process | Out-Host -Paging
Clear-Host
The Clear-Host function removes all text from the current display, including commands and output that might have accumulated. When complete, it displays the command prompt. You can use the function name or its alias, CLS.
Clear-Host affects only the current display. It does not delete saved results or remove any items from the session. Session-specific items, such as variables and functions, are not affected by this function.
Because the behavior of the Clear-Host function is determined by the host program, Clear-Host might work differently in different host programs.
Read-Host
The Read-Host cmdlet reads a line of input from the console. You can use it to prompt a user for input. Because you can save the input as a secure string, you can use this cmdlet to prompt users for secure data, such as passwords, as well as shared data.
$pwd_secure_string = Read-Host "Enter a Password" -AsSecureString
-AsSecureString
Indicates that the cmdlet displays asterisks (*) in place of the characters that the user types as input.
The Get-Host cmdlet gets an object that represents the program that is hosting Windows PowerShell.
The default display includes the Windows PowerShell version number and the current region and language settings that the host is using, but the host object contains a wealth of information, including detailed information about the version of Windows PowerShell that is currently running and the current culture and UI culture of Windows PowerShell. You can also use this cmdlet to customize features of the host program user interface, such as the text and background colors.
Out-Host
Sends output to the command line.
The Out-Host cmdlet sends output to the Windows PowerShell host for display. The host displays the output at the command line. Because Out-Host is the default, you do not have to specify it unless you want to use its parameters to change the display.
Get-Process | Out-Host -Paging
Clear-Host
The Clear-Host function removes all text from the current display, including commands and output that might have accumulated. When complete, it displays the command prompt. You can use the function name or its alias, CLS.
Clear-Host affects only the current display. It does not delete saved results or remove any items from the session. Session-specific items, such as variables and functions, are not affected by this function.
Because the behavior of the Clear-Host function is determined by the host program, Clear-Host might work differently in different host programs.
Read-Host
The Read-Host cmdlet reads a line of input from the console. You can use it to prompt a user for input. Because you can save the input as a secure string, you can use this cmdlet to prompt users for secure data, such as passwords, as well as shared data.
$pwd_secure_string = Read-Host "Enter a Password" -AsSecureString
-AsSecureString
Indicates that the cmdlet displays asterisks (*) in place of the characters that the user types as input.
Comments
Post a Comment