第1个回答 2009-12-24
@echo off&setlocal enabledelayedexpansion&for /f "delims=" %%a in ('dir /s/b *.txt') do for /f "delims=" %%b in ('type "%%a"') do (set /a a+=1
if !a! == 1 (
set a=%%b
set b=!a:~0,9!.txt
ren "%%a" "!b!"))
LS..你的代码1
多写了set n=0
没用
----------------------------- 问题2 ------------------------------
@echo off&setlocal enabledelayedexpansion&for /f "delims=" %%a in ('dir /s/b *.txt') do for /f "delims=" %%b in ('type "%%a"') do (set /a a+=1
if !a! == 1 (
set a=%%b
set b=!a:~2,9!.txt
ren "%%a" "!b!"))