0

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.

2
  • 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! If result.ext is omitted, secondfile.ext will be append to firstfile.ext. In that case firstfile.ext cannot contain wildcards and cannot match any wildcard in secondfile.ext. See COPY /?.
    – Akina
    Commented May 15, 2019 at 5:46
  • I want to combine files 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.
    – bhr
    Commented May 15, 2019 at 8:48

1 Answer 1

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .