I have a header text file with all the column names used as a template. I have a bunch of file types which open in notepad with the ext of .cos
What I have been doing so far is pending the header file with the content of all .cos files by using the following:
type *.cos >> header.txt
However I need to know how I can append the header files to each .cos individually and have an output name as a input name of the .cos file (maybe into a new directory) so it wont overwrite the original
if anyone can please help.
Thank you
@echo off
setlocal enabledelayedexpansion
set C:\Users\hyea\Desktop\Testing\Source=src
set C:\Users\hyea\Desktop\Testing\Target=dst
set C:\Users\hyea\Desktop\Testing\Target="%_DSTDIR%\target.txt"
type "%C:\Users\hyea\Desktop\Testing\Source%\header.txt"
> %C:\Users\hyea\Desktop\Testing\Target%
for /f "tokens=*" %%f in ('dir /b /a-d
"!C:\Users\hyea\Desktop\Testing\Source!\*.cos"') do (
type "!C:\Users\hyea\Desktop\Testing\Source!\%%f" >>
%C:\Users\hyea\Desktop\Testing\Target%
)