@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了