Reputation: 300
Consider the following example:
Read-Host "Enter a value"
While this works fine, every time the user hits enter after entering a value, the same value is echoed on the next line. This is driving me nuts. There must be a way of remove this stupid echo?
Upvotes: 1
Views: 2463
Reputation: 2013
On a PowerShell subprocess inside NodeJS, Read-Host
didn't work for me. I had to do it this way:
$null = [Console]::ReadLine()
Upvotes: 0
Reputation: 1621
In PowerShell Core, you need to use -MaskInput as in:
$pwd_string = Read-Host "Enter a Password" -MaskInput
Upvotes: 1
Reputation: 247471
Pass the entered value into a variable
$value = Read-Host "Enter a value"
unless I pass the variable back out to host like in the following example
$value = Read-Host "Enter a value"
$value
it won't be echoed.
Upvotes: 3