纯 P 实现输入密码时不显示。 ( 障眼法)
代码思路来源与cn-dos的模拟线程。
http://www.cn-dos.net/forum/viewthread.php?tid=39880&fpage=1&highlight=%E7%BA%BF%E7%A8%8B
感觉似乎有点取巧,欢迎板砖 ^_^
改为滚动式的,大家看效果是否好点?
障眼法...... 让人看不清到底输入了什么。 | @echo off&color 1f | | title code 随风 @bbs.bathome.net 2008-05-08 | | set "str=eaGOhrF+/.gvUsI\?52QKky1DZilnL3VPbH9ECjNm7S#t60Ap-TqwYXMB,Jzcd:uxofR@W48" | | if "%~1"=="loop" ( | | for /l %%a in (1 1 75) do call set "t=%%t%%" | | for /l %%a in (1 1 70) do call set "ko= %%ko%%" | | echo.&goto loop | | ) | | subst z: "%cd%" | | start /b %~s0 loop | | cls&echo.&echo 请输入密码,输入过程将不显示输入内容。 | | set /p code= | | subst z: /d | | cls&echo.&echo 你输入的密码是:%code% | | echo.&pause | | :loop | | if not exist z: exit | | set /p=%str% <nul | | set /p=%t%<nul | | for /l %%a in (1 1 500) do ver>nul | | set /p=%ko%<nul | | set /p=%t%<nul | | set /a w=%random%%%70+5,h=w+1 | | call set str=%%str:~%w%,1%%%str:~-1%%%str:~0,%w%%%%%str:~%h%,-1%% | | goto loopCOPY |
显示*号,缺点是 密码明文会在首位闪现
: | @echo off&color 1f | | title code 随风 @bbs.bathome.net 2008-05-08 | | if "%~1"=="loop" ( | | for /l %%a in (1 1 70) do call set "t=%%t%%" | | echo.&goto loop | | ) | | subst z: "%cd%" | | start /b %~s0 loop | | cls&echo.&echo 请输入密码,输入过程将不显示输入内容。 | | set /p code= | | subst z: /d | | cls&echo.&echo 你输入的密码是:%code% | | echo.&pause | | :loop | | if not exist z: exit | | set /p= **************<nul | | set /p=%t%<nul | | for /l %%a in (1 1 500) do ver>nul | | set /p= <nul | | set /p=%t%<nul | | goto loopCOPY |
|