本帖最后由 CrLf 于 2013-1-20 21:22 编辑
encode 代码,和之前的版本一样,也是拖动原始的 .com 文件到 encode.bat 图标上执行
代码如下:- @echo off&setlocal enabledelayedexpansion
- set compress=true
- ::设置是否压缩
-
- if "%~1"=="" echo 无文件&pause&exit/b
- set "s1=%~s1"
-
- set list=0123456789JKLMNO
- for %%a in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do (
- set hb=!list:~0x%%a,1!
- for %%b in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do (
- set lb=!list:~0x%%b,1!
- set "hex%%a%%b=!hb!!lb!"
- if %compress%==true (
- if 0x%%a%%b geq 0x50 if 0x%%a%%b leq 0x7e set "hex%%a%%b="
- for %%c in (5E 7C) do if %%a%%b==%%c set "hex%%a%%b=!hb!!lb!"
- )
- )
- )
- ::获取 hex 表
-
- for %%a in ("%~1") do cmd/c exit/b %%~za
- if !errorlevel! gtr 0x3030 (
- echo 文件太长
- pause&exit/b
- )
- ::判断文件长度
-
- set cx=!=exitcode:~-4!
- echo d100l!cx!^&echo q|debug !s1! >"%~n1.bat"
- ::获取文件 hex
-
- set m=0
- (for /f %%a in ('find /n /v ""^<"%~n1.bat"') do (
- set "var="&set /p "var="
- if "!var::=!" neq "!var!" (
- set "var=!var:-= !"
- set "str=!var:~61!"
- set "var=!var:~11,48!"
- for %%b in (!var!) do (
- if defined hex%%b (set "com=!com!!hex%%b!") else set "com=!com!!str:~,1!"
- set "str=!str:~1!"
-
- if "!com:~77!" neq "" (
- set /a m+=1
- set "com!m!=!com!"
- set "com="
- )
- )
- )
- ))<%~n1.bat"
-
- if defined com set /a "m+=1"&set "com!m!=!com!"
-
- (echo @echo off
- echo @(echo RQPUWP]UZV_BBBB5``PY(E.(E3^^^)E5^^^)E:(E^^^>^^^)EFSX3CH^^^<P}pE^^^< ~r%%%%ooQRY2AY0@G uG0EGB?
- echo echo KO00O0KNX01K91200JMJKN2OLN9J8NNKO0001KNp01K93030JMJKN2OLKN0001_]XYZN9N810
- for /l %%a in (1 1 !m!) do echo echo;!com%%a!
- echo ^)^>"%~n1.com"
- echo ::这个 bat 是生成 "%~n1.com" 的模板,使用时可以直接复制
- echo pause)>"%~n1.bat"
-
- start notepad "%~n1.bat"
复制代码
|