Created
May 9, 2018 18:12
-
-
Save ob1-sc/14c31ea218794d46ea8d13be294eea47 to your computer and use it in GitHub Desktop.
Accept masked input from bat script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
set "psCommand=powershell -Command "$pword = read-host 'Enter Password' -AsSecureString ; ^ | |
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^ | |
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)"" | |
for /f "usebackq delims=" %%p in (`%psCommand%`) do set password=%%p | |
echo %password% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment