I have multiple file such as ox.001,ox.002,...,ox.0050. I Want to append myFiles for example ox.001 to ox.0050 or ox.0060 to ox.0080 into one file then fileName result ox.0051 or ox.0081.
1 Answer
that user select first and end file name.i think use (for function) loop and define 2 variable for user choice file name in this condtion.
@echo off
:get1
set /P file1=Insert first source file name:
if exist %file1% goto get2
echo %file1% not found!
goto get1
:get2
set /P file2=Insert second source file name:
if exist %file2% goto get3
echo %file2% not found!
goto get2
:get3
set /P file3=Insert target file name:
if not exist %file3% goto docopy
echo %file3% already exists!
goto get3
:docopy
copy /b %file1%+%file2% %file3%
set file1=
set file2=
set file3=
echo Done
Filename may contain or not contain both drive and folder.
If some filename is LFN containig spaces or another special chars it must be enclosed with double-quotes while entering (correctness is not checked!).
COPY firstfile.ext+secondfile.ext result.ext
. If files are not text files - add/B
key. You may use wildcards in source files list. No spaces before/after plus signs! Ifresult.ext
is omitted,secondfile.ext
will be append tofirstfile.ext
. In that casefirstfile.ext
cannot contain wildcards and cannot match any wildcard insecondfile.ext
. SeeCOPY /?
.