gddsssko 当前离线
列兵
wanghan519 当前离线
二级士官
#&cls&powershell "type '%~0'|out-string|iex"&pause&exit dir -Directory | Rename-Item -NewName {$_.Name -replace '(-\d+)-.*$','$1'}复制代码
TOP
ShowCode 当前离线
VIP1
@echo off for /f "delims=" %%i in ('dir /b /ad ^| findstr ".*-.*-"') do ( set "OldName=%%i" setlocal enabledelayedexpansion for /f "tokens=1,2,* delims=-" %%a in ("!OldName!") do ( echo "!OldName!" -^> "%%a---%%b" ren "!OldName!" "%%a---%%b" ) endlocal ) pause复制代码
77七 当前离线
少校
@echo off cd /d "%~dp0" for /f "delims=" %%d in ('dir /b /ad') do ( for /f "tokens=1* delims=0123456789" %%a in ("#%%d") do ( set name=%%d setlocal enabledelayedexpansion ren "!name!" "!name:%%b=!" endlocal ) ) pause复制代码
评分人数
hfxiang 当前离线
上尉
@echo off rem 建议保存为ANSI编码格式 for /f "delims=" %%a in ('dir /b /s /a-d') do ( for /f "delims=" %%b in ('echo;%%~na^|gawk -v"FPAT=^[^0-9]*[0-9]+" "{print $1}"') do ( ren "%%a" "%%b%%~xa" ) )复制代码