윈 도 우 set /p PW= 질문입니다
2019.07.16 02:38
이러면 패스워드 입력부분이 모두 노출됩니다. ***** 나오도록 하는 방법 있을까요?
댓글 [4]
-
comadot 2019.07.16 20:43
-
지룡자 2019.07.20 14:23
허걱 감사합니다.
-
comadot 2019.07.16 20:56
@echo off & setlocal
Title %~n0
Mode 50,5 & Color 9E
Set /P "Pass1=Please choose your Password:" < Nul
call :HInput Pass1
echo Input length is %errorlevel%
setlocal EnableDelayedExpansion
echo Your password is !Pass1!
pause
cls
Set /P "Pass2=Please confirm your Password:" < Nul
call :HInput Pass2
echo Input length is %errorlevel%
echo Your password is !Pass2!
pause
cls
If !Pass1!==!Pass2! (echo the two passwords are the same
) else (echo the two passwords does not match)
pause
goto :eof
:HInput [ByRef_VarName]
:: inspired by Carlos
if "%__HI__%" neq "__HI__" (
setlocal DisableDelayedExpansion EnableExtensions
set "CR=" &set "S=" &set "N=0" &set "__HI__=__HI__"
for /f "skip=1" %%i in ('echo(^|replace ? . /u /w') do if not defined CR set "CR=%%i"
for /f %%i in ('"prompt $H &for %%b in (1) do rem"') do set "BS=%%i"
)
set "C="
for /f skip^=1^ delims^=^ eol^= %%i in ('replace ? . /u /w') do if not defined C set "C=%%i"
setlocal EnableDelayedExpansion EnableExtensions
if "!CR!"=="!C!" (
echo(
if "%~1"=="" (
echo(!S!
endlocal &endlocal &exit /b %N%
) else (
if defined S (
for /f delims^=^ eol^= %%i in ("!S!") do endlocal &endlocal &set "%~1=%%i" &exit /b %N%
) else endlocal &endlocal &set "%~1=" &exit /b 0
)
)
if "!BS!"=="!C!" (
set "C="
if defined S set /a "N -= 1" &set "S=!S:~,-1!" &<nul set /p "=%BS% %BS%"
) else set /a "N += 1" &<nul set /p "=*"
if not defined S (
endlocal &set "N=%N%" &set "S=%C%"
) else for /f delims^=^ eol^= %%i in ("!S!") do endlocal &set "N=%N%" &set "S=%%i%C%"
goto HInput역시 구글에서 찾았습니다.
이건 **로 표시되네요~
-
지룡자 2019.07.20 14:23
좀 길지만 대단히 감사합니다.
@echo off
setlocal
set /P "=_" < NUL > "Enter password"
findstr /A:1E /V "^$" "Enter password" NUL > CON
del "Enter password"
set /P "password="
cls
color 07
echo The password read is: "%password%"
구글에서 찾았습니다.
* 표시가 아니고 입력하는게 안보이네요~