布布丁 当前离线
列兵
@echo off setlocal enabledelayedexpansion for %%a in (*.txt) do set "txt=%%a" & call :aa pause :aa for /f "usebackq skip=1 delims=*" %%b in ("!txt!") do ( set "a=%%a" & set "b=%%b" ren "!a!" "!b!_!a!" goto :eof )复制代码
77七 当前离线
中校
for /f "delims=" %%a in ('dir /b /a-d *.txt') do set "txt=%%a" & call :aa复制代码
评分人数
TOP
qixiaobin0715 当前在线
大校
@echo off setlocal enabledelayedexpansion for /f "delims=" %%a in ('dir /b /a-d *.txt') do ( for /f "delims=" %%i in ('type "%%a"') do set Prefix=%%i ren "%%a" "!Prefix!_%%a" ) pause复制代码
@echo off set LineNo=5 setlocal enabledelayedexpansion for /f "delims=" %%a in ('dir /b /a-d *.txt') do ( set n=0 for /f "delims=" %%i in ('type "%%a"') do ( set /a n+=1 if !n! equ %LineNo% set Prefix=%%i ) if defined Prefix ren "%%a" "!Prefix!_%%a" set Prefix= ) pause复制代码