PowerShell: Input Output

Output

PS C:\> "Hello, World"
Hello, World

PS C:\> $str = "Hello, World"
PS C:\> $str
Hello, World

PS C:\> [System.Console]::WriteLine("Hello, World")
Hello, World

PS C:\> [System.Console]::WriteLine("1. {0}", $str)
1. Hello, World

Input

PS C:\> Read-Host "Enter something"
Enter something: 123
123

PS C:\> $str = Read-Host "Enter something"
Enter something: 123
PS C:\> $str
123

PS C:\> $str = [System.Console]::ReadLine()
123
PS C:\> $str
123

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *