批处理加密
@echo off title By Ycool tools mode con: cols=80 lines=22 color 1f :start echo ╭───────────────╮ echo ╭─────────┤ BAT 加 密 工 具 ├─────────╮ echo │ ╰───────────────╯ │ echo │ │ echo │ 1、本工具用来对明文批处理文件进行加密! │ echo │ │ echo │ 2、直接把待加密批处理文件拖至本窗口释放即可! │ echo │ │ echo │ 3、加密后会在当前目录下生成NewCode.bat文件! │ echo │ │ echo │ 07年11月17日 BY Ycool │ echo ╰───────────────────────────────────╯ echo. set /p file=请输入需要加密的批处理文件名后按回车键[Q=退出]: if "%file%"=="q" goto quit echo %file%|findstr /i "\.bat$">nul && goto go echo %file%|findstr /i "\.c*$">nul && goto go cls echo ============== echo 请正确输入! echo ============== echo. echo. echo 按任意键重新输入...... pause>nul goto start :go if not exist "%file%" goto newly if exist encrypt.bat copy encrypt.bat encryptbak.bat echo %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a %%%%a >"%tmp%\encrypt.tmp" echo cls>>"%tmp%\encrypt.tmp" type "%file%">>"%tmp%\encrypt.tmp" setlocal enabledelayedexpansion for %%i in ("%tmp%\encrypt.tmp") do ( echo %%~zi >nul 2>nul set size=%%~zi set num=!size:~-1! set /a mod=!num!%%2 if !mod! equ 0 (goto even) else (goto odd) ) :even copy "%tmp%\encrypt.tmp" NewCode.bat del "%tmp%\encrypt.tmp" cls echo ========================================== echo 恭喜你, 批处理加密成功,已保存为NewCode.bat echo ========================================== echo. echo. echo 按任意键退出...... pause>nul goto quit :odd echo. >>"%tmp%\encrypt.tmp" copy "%tmp%\encrypt.tmp" NewCode.bat del "%tmp%\encrypt.tmp" cls echo ========================================== echo 恭喜你, 批处理加密成功,已保存为NewCode.bat echo ========================================== echo. echo. echo 按任意键退出...... pause>nul goto quit :newly cls echo ================================ echo 找不到批处理文件, 请重新输入! echo ================================ echo. echo. echo 按任意键开始...... pause>nul goto start :quit exit
出处:https://www.cnblogs.com/mic86/articles/1777028.html
https://www.jb51.net/article/10952.htm
=======================================================================================
批处理解密
@echo off mode con: cols=80 lines=25 :index color 27 cls echo ╭───────────────╮ echo │ │ echo ╭─────────┤ BAT 解 密 工 具 ├─────────╮ echo │ │ │ │ echo │ ╰───────────────╯ │ echo │ │ echo │ │ echo │ 本工具用来对混淆文本编码类型的加密批处理进行解密! │ echo │ │ echo │ 在下面填入需要解密的批处理按回车键即可. │ echo │ │ echo │ 建议直接把待解密的批处理文件拖曳至本窗口释放. │ echo │ │ echo │ 解密成功后会在本程序目录下生成"new_待解密文件名.文件后缀名" │ echo │ 格式的文件. │ echo │ │ echo │ 注意: 如果本目录下存在"new_待解密文件名.文件后缀名"的文件, │ echo │ 将会被替换. │ echo │ │ echo │ │ echo ╰───────────────────────────────────╯ echo. set route=%cd% set ravel= set /p ravel= 请输入要解密的批处理: set "ravel=%ravel:"=%" if /i "%ravel:~-4%"==".bat" if exist "%ravel%" goto go if /i "%ravel:~-4%"==".cmd" if exist "%ravel%" goto go cls echo ╭──────────╮ echo ╭─────────┤ 文 件 错 误 ├────────╮ echo │ ╰──────────╯ │ echo │ │ echo │ 指定文件不存在或文件不是批处理类型! │ echo │ │ echo │ 按任意键重新输入... │ echo │ │ echo ╰─────────────────────────────╯ echo. echo. echo 按任意键重新输入... pause >nul goto index :go for /f "tokens=*" %%c in ("%ravel%") do ( cd /d "%%~dpc" if exist "%route%\new_%%~nxc" attrib -s -h -r -a "%route%\new_%%~nxc" echo author:pengfei@www.cn-dos.net>"%route%\new_%%~nxc" for /f "tokens=*" %%i in (%%~nxc) do ( echo %%i>>"%route%\new_%%~nxc" ) ) cls echo ╭──────────╮ echo ╭─────────┤ 解 密 成 功 ├────────╮ echo │ ╰──────────╯ │ echo │ │ echo │ 恭喜, 批处理解密成功! │ echo │ │ echo ╰─────────────────────────────╯ echo. echo. echo 按任意键退出... pause >nul exit
出处:https://www.cnblogs.com/mic86/archive/2010/07/14/1777029.html 标签:bat,加密,goto,批处理,解密,echo,%%%%,encrypt From: https://www.cnblogs.com/mq0036/p/16618276.html