打包.bat

chenyajun  2020-02-02 10:48:11  阅读 2665 次 评论 0 条

@echo off

REM ======================================================================

REM

REM  

REM

REM NAME: 批量加密打包单个文件,并生成对应密码表

REM

REM AUTHOR: hitme ,

REM DATE  : 2009-04-16

REM

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))


:code

for /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\winrar

if 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

本文地址:http://www.chenyajun.net/index.php/post/47.html
版权声明:本文为原创文章,版权归 chenyajun 所有,欢迎分享本文,转载请保留出处!

评论已关闭!