简体   繁体   中英

Powershell: Function Prompt In Ps1 Script

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM