- PowerShell Tutorial
- PowerShell - Home
- PowerShell - Overview
- PowerShell - Environment Setup
- PowerShell - Cmdlets
- PowerShell - Files and Folders
- PowerShell - Dates and Timers
- PowerShell - Files I/O
- PowerShell - Advanced Cmdlets
- PowerShell - Scripting
- PowerShell - Special Variables
- PowerShell - Operators
- PowerShell - Looping
- PowerShell - Conditions
- PowerShell - Array
- PowerShell - Hashtables
- PowerShell - Regex
- PowerShell - Backtick
- PowerShell - Brackets
- PowerShell - Alias
- PowerShell Useful Resources
- PowerShell - Quick Guide
- PowerShell - Useful Resources
- PowerShell - Discussion
Powershell - Read-Host Cmdlet
Cmdlet
Read-Host cmdlet is used to read from the console.
In these example, we're see the Read-Host cmdlet in action.
Example
In this example, we'll ask the user to pass an input and read the input into a variable.
$choice = Read-Host "Please put your choice"
Powershell will show a popup to enter the value. Once you enter the value, it is saved in $choice variable. Now print the variable.
$choice
Output
You can see the value of variable.
1
powershell_advanced_cmdlets.htm
Advertisements