Imagine: you have some spiltted files and you want to merge them into the new file containing all of them. Of course, it is much simpler to perform this operation using a small batch script instead of copying data manually. Here you can see an example of this batch script (hope, it'll be quite understandable with the comments):
REM Advanced Files Merger
REM Adds files specified by mask to the end of the file passed as the first parameter
REM Masks or names of files to be added are passed as the second, the third, etc. parameters
REM E.g. usage is like: merger FileToBeExpanded.bin *.exe *.zip *.*
@ECHO off
IF '%1=='LooP GOTO %2
SET prgname=%0
SET destfile=%1
IF '%2==' GOTO done
IF not EXIST %2 GOTO done
:_loop
SHIFT
IF '%1==' GOTO done
FOR %%i in (%1) do CALL %prgname% LooP addfile %%i
GOTO _loop
:addfile
type %3>>%destfile%
echo.>>%destfile%
:done
We kindly remind that Dr.Batcher is the best program to create batch file, try it if haven't tried it yet.
REM Adds files specified by mask to the end of the file passed as the first parameter
REM Masks or names of files to be added are passed as the second, the third, etc. parameters
REM E.g. usage is like: merger FileToBeExpanded.bin *.exe *.zip *.*
@ECHO off
IF '%1=='LooP GOTO %2
SET prgname=%0
SET destfile=%1
IF '%2==' GOTO done
IF not EXIST %2 GOTO done
:_loop
SHIFT
IF '%1==' GOTO done
FOR %%i in (%1) do CALL %prgname% LooP addfile %%i
GOTO _loop
:addfile
type %3>>%destfile%
echo.>>%destfile%
:done
We kindly remind that Dr.Batcher is the best program to create batch file, try it if haven't tried it yet.
No comments:
Post a Comment