本帖最后由 zaqmlp 于 2019-12-5 16:28 编辑
- <# :
- cls
- @echo off
- set info=互助互利,支付宝扫码头像,感谢赞助
- rem 有问题,可加QQ956535081及时沟通
- title %info%
- set "rootpath=%~dp0"
- if "%rootpath:~-1%" equ "\" (set "rootpath=%rootpath:~,-1%")
- cd /d "%rootpath%"
- powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::Default))) -Args '%rootpath%'"
- echo;%info%
- pause
- exit
- #>
-
- $sa=New-Object -comObject Shell.Application;
- $fd=$sa.NameSpace(0);$v=0;
- for($i=0;$i -le 350;$i++){if($fd.GetDetailsOf($null, $i) -match '\b标题\b'){$v=$i;}};
- if($v -eq 0){write-host 'notmatch';exit;};
-
- $files=@(dir -liter $args[0]|?{('.mp3' -eq $_.Extension) -and ($_ -is [System.IO.FileInfo])});
- for($i=0;$i -lt $files.length;$i++){
- $objFolder=$sa.Namespace($files[$i].Directory.FullName);
- $objItem=$objFolder.ParseName($files[$i].Name);
- $title=$objFolder.GetDetailsOf($objItem, $v).trim();
- if($title -ne ''){
- $n=$title.PadLeft(5,'0');
- write-host ($files[$i].Name+' --> '+$n+'_'+$files[$i].Name);
- mv -liter $files[$i].FullName ($files[$i].Directory.FullName+'\'+$n+'_'+$files[$i].Name);
- };
- }
复制代码
|