Batch file to merge specific files into one? -
i newbie windows batch command please spare me irrelevant help. want merge files using type command of windows since files coming various sources need search in file name source filter , merge files. have tried writing below code it's not doing job me.
@echo off set filter=%1 set final_file=%2 echo %filter% echo %final_file% %f in (*.dlt) do( echo %f if find %filter "%f ( type "%f" >> %final_file ) )
here example made merge *.bat
files in 1 file; can modify needs : need modify variable set "filter_ext=dlt"
, set "masterfolder=%userprofile%\desktop"
yours
@echo off mode 75,3 & color 9e title merge *.bat in 1 file set "masterfolder=%userprofile%\desktop" set "output=output_merged_files.txt" set "filter_ext=bat" if exist "%output%" del "%output%" echo( echo please wait while generate output file ... @for /f "delims=" %%a in ('dir /s /b /a-d "%masterfolder%\*.%filter_ext%"') ( cls echo( echo please wait while ... merging "%%~nxa" ... ( echo ==================================================== echo contents of "%%a" echo ==================================================== type "%%a" echo( )>> "%output%" ) start "" "%output%"
edit merge .dlt in 1 file
@echo off mode 75,3 & color 9e title merge *.dlt in 1 file set "masterfolder=%~1" set "output=output_merged_files.txt" set "filter_ext=dlt" set "keyword=engine" if exist "%output%" del "%output%" echo( echo please wait while generate output file ... @for /f "delims=" %%a in ('dir /s /b /a-d "%masterfolder%\*.%filter_ext%" ^|find /i "%keyword%"') ( cls echo( echo please wait while ... merging "%%~nxa" ... ( echo ==================================================== echo contents of "%%a" echo ==================================================== type "%%a" echo( )>> "%output%" ) start "" "%output%"
Comments
Post a Comment