本帖最后由 zaqmlp 于 2019-4-23 02:45 编辑
- @echo off
- mode con lines=3000
- set info=互助互利,支付宝扫码头像,感谢赞助
- rem 有问题,可加QQ956535081及时沟通
- title %info%
- cd /d "%~dp0"
- powershell ^
- $list=dir *-*.txt^|?{$_ -is [System.IO.FileInfo]}^|group {$_.BaseName -replace '\d+$'};^
- foreach($item in $list){^
- $arr=@($item.group^|sort {[int]($_.BaseName -replace '^^.+-','')});^
- $max=$arr[$arr.length-1].BaseName -replace '^^.+-','';^
- for($i=0;$i -lt $arr.length;$i++){^
- $num=$arr[$i].BaseName -replace '^^.+-','';^
- $four=-join(($arr[$i].BaseName.split('-')[0])[-4..-1]);^
- $str='['+$max.PadLeft(2,'0')+'_'+$num.PadLeft(2,'0');^
- if($i -eq 0){^
- $str+='_A]';^
- }else{^
- if($i -eq ($arr.length-1)){^
- $str+='_B]';^
- }else{^
- $str+=']';^
- };^
- };^
- write-host ($arr[$i].Name+' --^> ['+$four.toUpper()+']'+$str+$arr[$i].Name);^
- mv -liter $arr[$i].Name ('['+$four.toUpper()+']'+$str+$arr[$i].Name);^
- };^
- }
- echo;%info%
- pause
复制代码
|