本帖最后由 WHY 于 2018-10-22 10:52 编辑
回复 17# missle3000
要求1:- @echo off
- PowerShell "$a=,'#EXTM3U'; dir . -Include *.flac, *.wav, *.wma, *.mp3 -Recurse|sort Name|group DirectoryName|%%{sc -Literal ($_.Name -replace '[^\\]+$','$0\$0.m3u') -Value ($a+($_.Group|select -Exp Name)) -Enc UTF8}"
- pause
复制代码 要求2:- @echo off
- PowerShell "$a=,'#EXTM3U';$L='%~dp0'.Length;dir . -Include *.flac, *.wav, *.wma, *.mp3 -Recurse|sort Name|group DirectoryName|%%{$b+=$_.Group|%%{$_.FullName.SubString($L)};sc -Literal ($_.Name -replace '[^\\]+$','$0\$0.m3u') -Value ($a+($_.Group|%%{$_.Name})) -Enc UTF8};sc '汇总.m3u' -Value ($a+$b) -Enc UTF8"
- pause
复制代码 要求3,不考虑文件重名:- @echo off
- PowerShell "$a=,'#EXTM3U';$L='%~dp0'.Length;dir . -Include *.flac, *.wav, *.wma, *.mp3 -Recurse|sort Name|group DirectoryName|%%{$v=$_.Group|%%{$_.FullName.SubString($L)};sc -Literal (($_.Name -replace '.*\\')+'.m3u') -Value ($a+$v) -Enc UTF8; $b+=$v};sc '汇总.m3u' -Value ($a+$b) -Enc UTF8"
- pause
复制代码
|