@echo off
REM ======================================================================REM
REM
REM
REM NAME: 批量加密打包单个文件,并生成对应密码表
REM
REM AUTHOR: hitme ,REM DATE : 2009-04-16REM
REM COMMENT: 密码由随机数字组成,长度与文件名长度相同
REM
REM ======================================================================@echo off:repare
del ws-lfcn.txt tmp.txt 2>nul
md www.ws-lf.cn 2>nul
setlocal ENABLEDELAYEDEXPANSION:input
echo.set /p input=加密打包文件还是文件夹^(F=文件,D=文件夹,A=全部^)echo.if /i "%input%"=="f" (set key=/aa) else (
if /i "%input%"=="d" (set key=/ad) else (
if /i "%input%"=="a" (set key=) else goto :input)):codefor /f "delims=" %%i in ('dir %key%/b^|findstr /v "%~nx0 www.ws-lf.cn"') do (
echo.%%i>tmp.txt
echo. >>tmp.txt for /f "delims=:" %%a in ('findstr /o "." tmp.txt') do (
set /a len=%%a - 2
)
set m=
for /l %%l in (1,1,!len!) do (
echo %random% >nul
set m=!m!!random:~-1!
)
echo %%i:!m!>>ws-lfcn.txt
del tmp.txt>nul
)endlocal:www.ws-lf.cn
setlocal
set path=%path%;c:\program files\winrarif exist ws-lfcn.txt (
for /f "tokens=1* delims=:" %%i in (ws-lfcn.txt) do rar a -p%%j "www.ws-lf.cn\%%~ni.rar" "%%i"
move ws-lfcn.txt www.ws-lf.cn
start www.ws-lf.cn) else echo...未能打包 & pause
endlocal