1 @echo off 2 color 0A 3 title 批处理变量加密解密工具 4 5 if "%1" EQU "" ( 6 set /p file=目标文件路径: 7 ) else ( 8 set file=%1 9 ) 10 11 (for /f "delims=" %%a in (%file%) do ( 12 set tv=%%a 13 setlocal enabledelayedexpansion 14 set tv=!tv:^&=#_1_#! 15 set tv=!tv:^|=#_2_#! 16 set tv=!tv:^<=#_3_#! 17 set tv=!tv:^>=#_4_#! 18 set tv=!tv:^^=^^^^! 19 for /f "delims=" %%b in ("!tv!") do ( 20 endlocal 21 echo; | ^> tmp.txt echo %%b 22 ) 23 24 for /f "delims=" %%b in (tmp.txt) do ( 25 set tv2=%%b 26 setlocal enabledelayedexpansion 27 set tv2=!tv2:#_1_#=^&! 28 set tv2=!tv2:#_2_#=^|! 29 set tv2=!tv2:#_3_#=^<! 30 set tv2=!tv2:#_4_#=^>! 31 echo !tv2! 32 if "!tv2:set =!" neq "!tv2!" (endlocal&call %%a) else (endlocal) 33 ) 34 ))>out.txt 2>nul 35 36 del tmp.txt 37 38 cls & echo 尝试解密完成: & echo =============================================================================== 39 type out.txt 40 echo ===============================================================================& pause > nul