这里是我做了合并在一个文件中的所有文件*.bat
一个例子;所以你可以很容易地修改您的需求: 只要你需要修改变量Set "Filter_Ext=dlt"
和Set "MasterFolder=%userprofile%\desktop"
到你
@echo off
Mode 75,3 & Color 9E
Title Merge all *.bat in one file
Set "MasterFolder=%userprofile%\desktop"
Set "OutPut=Output_Merged_Files.txt"
Set "Filter_Ext=bat"
If exist "%OutPut%" Del "%OutPut%"
echo(
echo Please Wait a while we generate the output file ...
@For /f "delims=" %%a in ('Dir /s /b /A-D "%MasterFolder%\*.%Filter_Ext%"') Do (
cls
echo(
echo Please Wait a While ... Merging "%%~nxa" ...
(
echo ====================================================
echo Contents of "%%a"
echo ====================================================
Type "%%a"
echo(
)>> "%OutPut%"
)
Start "" "%OutPut%"
编辑合并所有.dlt在一个文件中
@echo off
Mode 75,3 & Color 9E
Title Merge all *.dlt in one 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 a while we generate the output file ...
@For /f "delims=" %%a in ('Dir /s /b /A-D "%MasterFolder%\*.%Filter_Ext%" ^|find /I "%KeyWord%"') Do (
cls
echo(
echo Please Wait a While ... Merging "%%~nxa" ...
(
echo ====================================================
echo Contents of "%%a"
echo ====================================================
Type "%%a"
echo(
)>> "%OutPut%"
)
Start "" "%OutPut%"
每个
你的'for'语句中的'%f'必须是'%% f'。如果从批处理文件运行,则需要将“变量”上的'%'加倍。可悲的是,你的问题描述“这不是为我工作”并没有给我们提供很多线索,说明为什么这个过程没有达到你期望的效果。 – Magoo
@Mangoo你会如何解决上述问题?只需简单地考虑一下,你必须循环扩展名为.dlt的所有文件,并且文件名必须包含过滤器'Engine'(例如:Filexxx_Engine_27_07_2017_01.dlt),然后使用type命令将所有这些文件合并到Engine_All.dlt中? –
你只想合并'* .dlt'文件?你的主文件夹位于哪里? – Hackoo