:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::运行环境2000、xp或更高 ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@Echo Off
Title CAB文件夹最大压缩工具
Set Prestr=MAKECAB /v3 /D CompressionType=LZX /D CompressionMemory=21 /D MaxDiskSize=CDROM /D Cabinet=On /D Compress=On
:begin
Set fullname=%~1
Set dirpath=%~dp1
Set srcname=%~n1
if exist "%fullname%\" goto is_dir
:is_file
Set Cmdstr=%Prestr% "%fullname%" "%dirpath%%srcname%.CAB"
%Cmdstr%
Set Cmdstr=
shift
Set tmpstr=%1
if not %tmpstr%=="" goto begin
goto end
:is_dir
Set Cmdstr=%Prestr% /D FolderSizeThreshold=5000000 /D DiskDirectoryTemplate="%dirpath%." /D CabinetNameTemplate="%srcname%.CAB"
Set Tempfile=%TEMP%\mkcabtmp.tmp
If Exist "%Tempfile%" Del "%Tempfile%" >NUL
SETLOCAL ENABLEDELAYEDEXPANSION
For /f "delims=" %%i In ('dir "%fullname%" /s /b /a-d') Do (
Set subname=%%i
Set "subname=!subname:%fullname%\=!"
Echo "%%i" "!subname!">>%Tempfile%
)
ENDLOCAL
%Cmdstr% /F %Tempfile%
Del /F /S /Q "%Tempfile%" SETUP.INF SETUP.RPT >NUL
Set Tempfile=
Set Cmdstr=
shift
Set tmpstr=%1
if not %tmpstr%=="" goto begin
:end
Set tmpstr=
Set srcname=
Set dirpath=
Set fullname=
Set Prestr=
[[i] Last edited by netwinxp on 2007-7-27 at 11:41 AM [/i]]
[ Last edited by netwinxp on 2007-7-27 at 04:09 PM ]作者: csx163 时间: 2007-9-19 00:32 LZ的程序确实能批量打包,不过打包后的路径和文件名加在一起了
如:
D:外置程序PE_OUTERPART新建文件夹DRIVERS_NET3COM3c940_3c2000EL2000x.inf