Board logo

标题: [其他] 求助批处理动态密码问题 [打印本页]

作者: ANSL    时间: 2022-11-5 20:33     标题: 求助批处理动态密码问题

各位大神好!
如各位大神有能力请帮忙做个批处理:一次生成三个密码(5位数),三个密码生成时保存时间到配置文件中,结束时间是1小时(下次打开的时候时间相差大于等于一小时重换密码,三个密码用哪个都行,一个密码只能用1次,,不能用的加入黑名单配置文件中)

不是我不想做,不练,不写,是真的因为本人代码风格笨拙,也没有能力!


以下贴出本人代码(不要运行,也不要改)
  1. @echo off
  2. Setlocal EnableDelayedExpansion
  3. setlocal enableextensions
  4. :lodd
  5. if not exist conf.ini goto hua
  6. if not exist pwd goto hua
  7. set tme=%date:~0,4%%date:~5,2%%date:~8,2%
  8. call :line conf.ini Date tmp
  9. call :line conf.ini MaxER tmp1
  10. call :read2 tmp
  11. call :read3 err
  12. call :read1 tmp1
  13. echo %max% %ec% %wct%
  14. pause
  15. if "%ec%" GEQ "%tme%" set/a %wct%+1=wct
  16. if "%wct%" GTR "%max%" exit
  17. goto main
  18. :main
  19. echo %wct%>err
  20. echo.
  21. echo.
  22. echo 动态密码2022/11/16 失效
  23. echo.
  24. echo.
  25. pause
  26. cls
  27. echo.
  28. set/p ab=密码:
  29. call :pwd %ab% pwd
  30. goto main
  31. :line
  32. (for /f "delims=" %%a in (%1) do (
  33.     set str=%%a
  34.     if "!str:~,1!"=="[" (
  35.         if "%%a"=="[%2]" (
  36.             set n=true
  37.         ) else (
  38.             set n=
  39.         )
  40.     ) else if defined n (
  41.         echo,%%a
  42.     )
  43. ))>%3
  44. goto :eof
  45. :hua
  46. if exist pwd del pwd /s /q /f >nul
  47. echo %random%-%random%-%random%>pwd
  48. ECHO 完成.
  49. goto lodd
  50. :pwd
  51. cd /d "%~dp0"
  52. set "return=NotFound"
  53. set "input=Nothing"
  54. set "input=%1"
  55. for /f "delims=:" %%i in ('type "%2" ^| findstr /n /l /x /c:"%input%"') do (
  56.     set "return=%%i"
  57. )
  58. if "%rerurn%"=="NotFound" goto main
  59. if "%input%"=="Nothing" goto main&set /a wct=%wct%+1
  60. call :del %return%
  61. goto install
  62. :del
  63. for /f "delims=" %%i in ('%1') do (
  64.         (set n=0
  65.         for /f "delims=" %%j in ('type "%%i"') do (
  66.                 set /a n+=1
  67.                 if not "!n!"=="1" echo %%j
  68.         ))>$
  69.         move $ "%%i">nul
  70. )
  71. :read1
  72. for /f "delims=" %%i in (%1) do (
  73.     set max=%%i
  74. )
  75. goto :eof
  76. :read2
  77. for /f "delims=" %%m in (%1) do (
  78.     set ec=%%i
  79. )
  80. goto :eof
  81. :read3
  82. for /f "delims=" %%b in (%1) do (
  83.     set wct=%%i
  84. )
  85. goto :eof
  86. :err
  87. echo.
  88. echo 不能找到文件!
  89. pause>nul
  90. exit
  91. :install
  92. pause
  93. exit
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2