Just discovered that it can be like this originally, learning...
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
DigestI
View 110,351 Replies 364
@echo off
title bat变量加密程序
mode con: cols=80 lines=25
color 27
set route=%cd%
if not %1*==* set ravel=%1&goto jmp
:index
cls
echo ╭───────────────╮
echo │ │
echo ╭─────────┤ BAT 变 量 加 密 程 序 ├─────────╮
echo │ │ │ │
echo │ 测试版: ╰───────────────╯ │
echo │ │
echo │ 本工具采用变量截取加密算法, 加密后文件大小会增加5-10倍, 批处理 │
echo │ 的运行效率不会有任何影响. │
echo │ │
echo │ 在下面输入需要加密的批处理按回车键即可, 建议直接把待加密的 │
echo │ 批处理文件拖曳至本窗口释放. │
echo │ │
echo │ 加密成功后会在本程序目录下生成"new_待加密文件名.bat"格式的文件. │
echo │ │
echo │ 注意: 1. 屏幕如无"加密成功"的提示或中间退出, 说明加密失败. │
echo │ 2. 此加密算法要处理的数据量很大, 速度比较慢, 请耐心等待. │
echo │ 3. 可能还存在其他未知缺陷, 加密后请自行检测错误. │
echo │ 4. 修正了加密后大写字母变小写的缺陷. │
echo │ │
echo │ pengfei@www.cn-dos.net │
echo ╰───────────────────────────────────╯
echo.
set ravel=
set /p ravel= 请输入要加密的批处理(q=exit):
:jmp
set "ravel=%ravel:"=%"
if /i "%ravel%"=="q" exit
echo %ravel% | findstr /c:( /c:) >nul 2>nul && goto :nay
if /i "%ravel:~-4%"==".bat" if exist "%ravel%" goto go
if /i "%ravel:~-4%"==".cmd" if exist "%ravel%" goto go
:nay
cls
echo ╭──────────╮
echo ╭─────────┤ 文 件 错 误 ├────────╮
echo │ ╰──────────╯ │
echo │ │
echo │ 1. 指定文件不存在或文件不是批处理类型. │
echo │ │
echo │ 2. 文件路径中含有括号. │
echo │ │
echo │ 3. 文件名中存在空格. │
echo │ │
echo │ │
echo ╰─────────────────────────────╯
echo.
echo.
echo 按任意键重新输入...
pause >nul
goto index
:go
for /f "tokens=*" %%c in ("%ravel%") do (
cd /d "%%~dpc"
set root="%route%\new_%%~nxc"
set file=%%~nxc
)
for %%i in (%file%) do if not "%%i"=="%file%" goto nay
if exist %root% call :exist
if exist %root% attrib -s -h -r -a %root%
call :caput
cls
echo.
echo \\\^|///
echo \\ .-.- //
echo ( .@.@ )
echo +-------oOOo-----(_)-----oOOo---------+
echo ^| ^|
echo ^| 正在加密中, 请稍等...... ^|
echo ^| ^|
echo +----------oooO-------Oooo------------+
echo.
echo.
for /f "delims=" %%i in (%file%) do (
set x=%%i■
call :start
)
cls
echo.
echo \\\^|///
echo \\ .-.- //
echo ( .@.@ )
echo +-------oOOo-----(_)-----oOOo---------+
echo ^| ^|
echo ^| 恭喜, 加密成功! ^|
echo ^| ^|
echo +----------oooO-------Oooo------------+
echo.
echo.
echo 按任意键退出...
pause >nul
goto :eof
:start
set term=0
set vcd=0
set "x=%x:"=◎%"
set "y=%x%"
set num=0
:follow
if not "%y%"=="" (
set "y=%y:~1%"
if "%y:~0,1%"=="◎" set /a num+=1
goto :follow
)
set /a z=%num%%%2
if "%x:~0,1%"==":" if not "%x:~0,2%"==":" set term=1
set result=
:next
if not "%x:~0,1%"=="■" (
if "%term%"=="1" (
if "%x:~0,1%"=="%%" set "result=%result%%x:~0,1%"&set "x=%x:~1%"&set term=0&goto next
if "%x:~0,1%"==" " set "result=%result%%x:~0,1%"&set "x=%x:~1%"&set term=0&goto next
if "%x:~0,1%"=="=" set "result=%result%%x:~0,1%"&set "x=%x:~1%"&set term=0&goto next
if "%x:~0,1%"==")" set "result=%result%%x:~0,1%"&set "x=%x:~1%"&set term=0&goto next
set "result=%result%%x:~0,1%"&set "x=%x:~1%"&goto next
)
if "%x:~0,1%"=="%%" set "result=%result%%x:~0,1%"&set "x=%x:~1%"&set term=1&goto next
if "%x:~0,1%"==" " set "result=%result% "&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="a" set "result=%result%%%appdata:~-1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="b" set "result=%result%%%tcopu:~1,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="c" set "result=%result%%%userprofile:~5,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="d" set "result=%result%%%appdata:~15,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="e" set "result=%result%%%comspec:~-1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="f" set "result=%result%%%tcopu:~11,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="g" set "result=%result%%%programfiles:~6,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="h" set "result=%result%%%tcopu:~2,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="i" set "result=%result%%%programfiles:~-4,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="j" set "result=%result%%%tcopu:~4,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="k" set "result=%result%%%tcopu:~5,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="l" set "result=%result%%%appdata:~-13,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="m" set "result=%result%%%appdata:~7,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="n" set "result=%result%%%userprofile:~14,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="o" set "result=%result%%%appdata:~-7,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="p" set "result=%result%%%appdata:~-15,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="q" set "result=%result%%%tcopu:~6,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="r" set "result=%result%%%programfiles:~4,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="s" set "result=%result%%%comspec:~-16,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="t" set "result=%result%%%comspec:~-13,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="u" set "result=%result%%%userprofile:~6,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="v" set "result=%result%%%tcopu:~8,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="w" set "result=%result%%%os:~5,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="x" set "result=%result%%%comspec:~-2,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="y" set "result=%result%%%comspec:~12,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="z" set "result=%result%%%tcopu:~9,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="0" set "result=%result%%%tcopu:~17,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="1" set "result=%result%%%tcopu:~21,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="2" set "result=%result%%%comspec:~-9,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="3" set "result=%result%%%comspec:~-10,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="4" set "result=%result%%%tcopu:~14,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="5" set "result=%result%%%tcopu:~16,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="6" set "result=%result%%%tcopu:~33,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="7" set "result=%result%%%tcopu:~12,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="8" set "result=%result%%%tcopu:~23,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="9" set "result=%result%%%tcopu:~29,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="(" set "result=%result%%%tcopu:~25,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"==")" set "result=%result%%%tcopu:~30,1%%"&set "x=%x:~1%"&goto next
if "%x:~0,1%"=="@" set "result=%result%%%tcopu:~32,1%%"&set "x=%x:~1%"&goto next
if "%vcd%"=="1" (
if "%x:~0,1%"=="◎" set vcd=0
if "%x:~0,1%"=="^" (
set "result=%result%^^^^^"&set "x=%x:~1%"&goto next
) else (
set "result=%result%%x:~0,1%"&set "x=%x:~1%"&goto next
)
)
if "%x:~0,1%"=="◎" set "result=%result%%x:~0,1%"&set "x=%x:~1%"&set vcd=1&goto next
set "result=%result%%x:~0,1%"&set "x=%x:~1%"&goto next
)
set "result=%result:◎="%"
if "%z%"=="0" (
set /p "auot=%result%"<nul>>%root%
echo.>>%root%
goto :eof
)
>>%root% echo %result%
goto :eof
:caput
(echo @%%comspec:~-1%%%%userprofile:~5,1%%h%%appdata:~-7,1%% %%appdata:~-7,1%%%%programfiles:~-5,1%%%%programfiles:~-5,1%%
echo %%comspec:~-16,1%%%%comspec:~-1%%%%comspec:~-13,1%% %%comspec:~-13,1%%%%userprofile:~5,1%%%%appdata:~-7,1%%%%appdata:~-15,1%%%%userprofile:~6,1%%=%%%%bh%%%%jkq%%%%vz%%%%f7%%%%4c50t%%%%u1w8%%%%^(cdf9^)%%%%@6tc%%%%)>%root%
goto :eof
:exist
cls
echo ╭──────────╮
echo ╭─────────┤ 替 换 文 件 ├────────╮
echo │ ╰──────────╯ │
echo │ │
echo │ 注意: 当前目录存在待加密批处理的同一更名文件. │
echo │ │
echo │ 1: 替换 2: 重新输入 │
echo │ │
echo │ │
echo ╰─────────────────────────────╯
echo.
echo.
set choice=
set /p choice= 请选择(1 2)回车:
if "%choice%"=="1" goto :eof
if "%choice%"=="2" goto index
goto exist
Originally posted by willsort at 2006-7-23 14:36:
Re pengfei:
This encryption mechanism has low versatility, is too narrow in applicable platforms, and has side effects (it will rename jpg files). Therefore, it is recommended that you do not spend too much effort on this solution.
Originally posted by zxcv at 2006-7-23 16:10:
Simpler:
Create a new "a.txt" text file, open it, copy 【ൡ挊獬】(excluding 【】), paste it into "a.txt" and when saving, it prompts "Contains Unicode characters...." select "Cancel", edit..