sunqv 当前离线
列兵
hfxiang 当前离线
上尉
dir *.JPG /b/a-d|sed -r "h;s/^(.{4})([0-9]+-[0-9]\.JPG)$/\10000\2/;s/^(.{4}).*([0-9]{4}-[0-9]\.JPG)$/\1\2/;x;G;s/^(.+)\n(.+)$/ren \1 \2/"|cmd.exe复制代码
TOP
dir *.JPG /b/a-d|sed -r -e"h;:a;/^(.{4})[0-9]{4}-([0-9]\.JPG)$/bb;s/^(.{4})([0-9]+-[0-9]\.JPG)$/\10\2/;ba;:b;x;G;s/^(.+)\n(.+)$/ren \1 \2/"|cmd.exe复制代码
sed -r ":a;/^(.{4})[0-9]{4}-([0-9]\.JPG)$/b;s/^(.{4})([0-9]+-[0-9]\.JPG)$/\10\2/;ba" a.txt>b.txt复制代码
Nsqs 当前离线
少尉
(?<=\D{3}\d+)\d+(?=-.+)复制代码
powershell -noprofile -executionpolicy bypass "dir *.jpg|%%{ren $_ ([regex]::Replace($_,'(?<=\D+\d+)\d+(?=-.+)',{param([string]$x) '{0:d4}' -f [int]$x}))}"复制代码
评分人数
77七 当前离线
中校
@echo off for /f "tokens=1* delims=-" %%a in ('dir /b /a-d *-*.jpg') do ( set a=%%a set b=%%b setlocal enabledelayedexpansion set c=0000!a:~4! ren "!a!-!b!" "!a:~0,4!!c:~-4!-!b!" endlocal ) pause复制代码
Five66 当前离线
@echo off for %%a in (*.JPG) do ( set "n=%%~na" setlocal enabledelayedexpansion if "!n:~4,-2!" neq "" ( set /a "m=10000!n:~4,-2!+0" 2>nul && rename "%%a" "!n:~0,4!!m:~-4!!n:~-2!%%~xa" 2>nul ) endlocal ) pause复制代码
pd1 当前离线
五级士官
powershell -c "dir *.jpg|%{$qian=$_.Name.Split('-');$newname='{1}{0:d4}-{2}' -f [int]$qian[0].Substring(4),$qian[0].Substring(0,4),$qian[1];ren $_ $newname}"复制代码