楼主是不是要这样的啊?
@echo off & setlocal Enabledelayedexpansion
cd /d c:\tool
for /f "delims=" %%a in ('dir/b *.bat') do (
set QuanChen=%%a
set Chen=!QuanChen:~0,-4!
echo !Chen!>>temp
echo !Chen!>!Chen!
)
exit
你说的不太清楚,是不是这样:
cd /d c:\tool
ren *.dat *
dir/b >temp