read-host -AsSecureString 返回结果到文本
网上讨论这个的不多,所以发出来以备后面的人查找read-host -AsSecureString 用于读取密码后返回System.Security.SecureString 类型的对象,其值不能直接write-host[code]$password=read-host -assecurestring
$decodedpassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))
write-host $decodedpassword[/code]
页:
[1]