How to prompt user for string and assign to variable?

I would like to prompt the user (“Enter value=”) for an input string.
The entered string should be assigned to variable “inputvarr”

How can I code this?

Have you read the help for Read-Host?

2 Likes

@pstein

$variable = read-host "Enter the number of your choice "

write-host ("The number you chose is {0}" -f $variable)

try that.

thank you!