给txt文档内容开头批量插入该文档标题 批处理怎么写

2025年03月23日 01:26
有1个网友回答
网友(1):

@echo off
set sum=0
for %%n in (*.txt) do (
cd. >content.temp
echo %%~nn >>content.temp
copy content.temp+%%n temp >nul
del /f /q content.temp >nul
del /f /q %%n
ren temp %%n
set /a sum=sum+1
)

echo 一共修改%sum%个.txt文件

pause

把上面的批处理复制到批处理文件中,然后把需要处理文件和批处理文件放在同一个文件夹下,运行在cmd运行批处理文件就ok了