Hello,
I am trying to create a bat file to allow password input at the command prompt. I use powershell with the following command:
:: =============================================================================================
:: Get Password - hide from the screen
:: =============================================================================================
SETLOCAL DISABLEDELAYEDEXPANSION
SET "psCommand=powershell -Command "$pword = read-host 'password' -AsSecureString ; ^
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
-join("0",[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR))""
for /f "usebackq delims=" %%p in (`%psCommand%`) do set D_PASSWORD=%%p
SETLOCAL ENABLEDELAYEDEXPANSION
SET D_PASSWORD=!D_PASSWORD:~1!
:: =============================================================================================
This works great for all but the exclamation mark (!) character
How can I fix my script to take this character?
Thanks!