November 2018
Intermediate to advanced
566 pages
17h 15m
English
This is straightforward. If you are comfortable using command discovery, you can simply use get-command *host to get the information. Modify the script we created for the Writing a simple script recipe to get the desired script:
Get-Date hostname Write-Output "Hello, $(Read-Host "Enter your name")!" # Verbose version: Write-Output "Hello, $(Read-Host -Prompt "Enter your name")!"
That is all it is; run the script:
PS> & './simple prompt script.ps1'
Read now
Unlock full access