Read and Write from the Interactive Shell

To write a value to the shell you can use the Write-Host command. It also allows you customize the console output.

$name = "Marius"
Write-Host -ForegroundColor White -BackgroundColor Black $name

To read a value from the interactive shell you can use Read-Host. This command will read a line of input from the console.

Write-Host "Please enter your age"
$age = Read-Host