Want to pull off something similar to " set /p variable = x
" from batch.
How can we make this happen in PS1?
Script example that im using
Function Prompt { 'PS' + $x + '>' }
The equivalent to set /p
in PowerShell would be Read-Host
:
$value = Read-Host "Give me some input"
The host application (eg. powershell.exe
) will now prompt the user for input with the caption Give me some input:
, and the result will be stored in $value
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.