luoye2010 当前离线
列兵
WHY 当前离线
上校
dir /b *.png | sort -n -r | gawk "{ if( match($0,/^([1-9][0-9]*|0)(\.[^.]+)$/,m) ) print $0, (m[1]+10)m[2] }"复制代码
TOP
netdzb 当前离线
上尉
dir /b *.png | gawk "{if(match($0,/^([1-9][0-9]*|0)\.[^.]+$/,m))a[$0]=1*m[1]}END{len=asort(a,b);for(i=len;i>0;i--)system(\"cmd /c Ren \"b[i]\".png \"(b[i]+10)\".png\")}"复制代码
PowerShell "dir *.png | ?{$_.BaseName -match '^([1-9]\d*|0)$'} | sort -Desc {1*$_.BaseName} | ren -NewName{''+(10+$_.BaseName)+$_.Extension}"复制代码
@echo off & setlocal enabledelayedexpansion if "%~1" EQU "ARG" ( for /f %%i in ( 'dir /b *.png ^| findstr /i /b /e "[1-9][0-9]*\.png 0\.png"') do ( set "s=0000000000%%~ni" set /a n=%%~ni+10 echo;!s:~-10! %%i !n! ) ) else ( for /f "tokens=2,3" %%i in ('"%~f0" ARG ^| sort /r') do ren "%%i" %%j%%~xi" pause & exit )复制代码
评分人数
zaqmlp 当前离线
went 当前离线
少校
@echo off REM png文件所在文件夹 set "dir=G:\test" for /f "delims=" %%i in ('dir /b "%dir%\*.png"') do ( REM 加10 set /a "newName=%%~ni+10" REM 重命名 call echo %%i -- %%newName%%%%~xi call rename "%dir%\%%i" "%%newName%%%%~xi" echo --------------------------------------- ) pause&exit复制代码