- @echo off
- set info=互助互利,支付宝扫码头像,感谢赞助
- rem 有问题,可加QQ956535081及时沟通
- title %info%
- cd /d "%~dp0"
- powershell -NoProfile -ExecutionPolicy bypass ^
- $fd='归类';^
- [void](md $fd -force);^
- $folders=@(dir^|?{($_.Name -ne $fd) -and ($_ -is [System.IO.DirectoryInfo])});^
- for($i=0;$i -lt $folders.length;$i++){^
- $file=@(dir -liter $folders[$i].FullName -r^|?{@('.xlsx' -contains $_.Extension) -and ($_ -is [System.IO.FileInfo])});^
- for($j=0;$j -lt $file.length;$j++){^
- $n=1;^
- $newname=$file[$j].Name;^
- $newfile=$fd+'\'+$newname;^
- while(test-path -liter $newfile){^
- $newname=$file[$j].BaseName+'('+$n.toString()+')'+$file[$j].Extension;^
- $newfile=$fd+'\'+$newname;^
- $n++;^
- };^
- write-host ($file[$j].FullName+' --^> '+$newfile);^
- mv -liter $file[$j].FullName $newfile;^
- };^
- }
- echo;%info%
- pause
复制代码
|