@echo off
set "psCommand=powershell -Command "$pword = read-host '请输入密码' -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
set "psCommand=powershell -Command "$pword1 = read-host '请再次确认' -AsSecureString ; ^
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword1); ^
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
for /f "usebackq delims=" %%p in (`%psCommand%`) do set password1=%%p
if "%password%" == "%password1%" ( echo 输入一致!正在加密...
java -cp druid-1.1.12.jar com.alibaba.druid.filter.config.ConfigTools %password1% >encrypted-password.txt
echo 加密成功!请查看文件:encrypted-password.txt & pause) else echo 两次输入不一致!& pause