@echo
on
set
dir
=%
CD
%
set
ofile=%
dir
%\output.txt
set
ofile1=%
dir
%\output_tmp.txt
echo
-- Merge file produced using batch file from %
dir
% > %ofile%
echo
. >> %ofile%
type
%
dir
%\1.txt >> %ofile%
echo
. >> %ofile%
echo
. >> %ofile%
type
%
dir
%\2.txt >> %ofile%
@echo
off
&
setlocal
EnableDelayedExpansion
for
/f "delims=" %%a in ('findstr /n .* %ofile%')
do
(
set
"str=%%a"
set
"str=!str:as=xx!"
echo
!str:~1! >>%ofile1%
)
for
/f "delims=" %%b in ('
type
%ofile1%')
do
(
set
"str=%%b"
echo
!str:~1! >>D:\new_A.txt
)
del
%ofile1%&
start
D:\new_A.txt
pause