REM CAB Archiver
REM Creates cabinet archives
REM BasePath is path to the directory to be archived (including trailing backslash)
REM Name is the name of targer cabinet archive without .CAB extension
REM This script first creates configuration file for Microsoft's makecab.exe utility
REM and then calls this utility to create archive
REM If MakeSFX is set to Y, the target archive will be self-extracting
REM Don't forget to set BasePath and Name before using this batch script
@ECHO Off
SET BasePath=
SET Name=Archive
SET MakeSFX=Y
IF EXIST Temp.cmd  DEL Temp.cmd
IF EXIST %Name%.ddf  DEL "%Name%.ddf"
ECHO .Set DiskDirectoryTemplate= >> "%Name%.ddf"
ECHO .Set Cabinet=on >> "%Name%.ddf"
ECHO .Set Compress=on >> "%Name%.ddf"
ECHO .Set CompressionType=LZX >> "%Name%.ddf"
ECHO .Set CompressionLevel=7 >> "%Name%.ddf"
ECHO .Set CabinetName1=%name%.cab >> "%Name%.ddf"
ECHO .set cabinetnametemplate=%name%*.cab >> "%Name%.ddf"
REM Possible values of MaxDiskSize: 1.44M, 1.25M, 1.2M, 720K, 360K, CDROM
ECHO .Set MaxDiskSize=CDROM >> "%Name%.ddf"
FOR /r %BasePath% %%f in (*.*) do CALL :IncLine "%%f"
CALL Temp.Cmd
%windir%\system32\makecab.exe /f ^"%Name%.ddf^"
IF %MakeSFX%==Y  ( 
COPY /b %windir%\system32\Extrac32.exe+%Name%.cab %Name%.exe
)
DEL Temp.Cmd
DEL %Name%.ddf
DEL Setup.inf
DEL Setup.rpt
GOTO :EOF
:IncLine
ECHO Set FN=%1 >> Temp.Cmd
ECHO Echo %%FN%% %%FN:%BasePath%=%% > > %Name%.ddf >>Temp.Cmd
GOTO :EOF
