flahmeshess said:
I want to do this...
I have 1 file called abc.txt.
I need to append this file to another file called header.TTT to create
another file called ABC-header.TTT
ie copy header.TTT + abc.txt ABC-header.TTT
Note that I also have to manipulate the extension.
I have a number of these abc.txt files with different names, so I need
a way to automate this.
Thanks.
Try this batch file:
@echo off
goto Start
=====================================
Append file2 to file1, then modify the name of file1.
Example: file1=abc.txt
file2=header.TTT
abc-header.TTT=header.TTT + abc.txt
Parameters: %1: name of file1
%2: name of file2
=====================================
:Start
if "%2"=="" echo Parameter missing! & goto :eof
for /F %%a in ('echo %1') do set name1=%%~na
for /F %%a in ('echo %2') do set name2=%%~na
for /F %%a in ('echo %2') do set ext2=%%~xa
echo copy %1 + %2 % name1%-%name2%%ext2%
Remove the word "echo" in the last line to activate the batch file.
Note the the two file names must not include embedded spaces.