本帖最后由 pendave 于 2015-1-28 00:00 编辑
回复 3# apang
亲,调用第三方我那个是个For遍历吧,我弄了半天都整合不好,晕死了- @set @n=0; /* & echo off
-
- set "JS=cscript -nologo -e:jscript"
- set "mp3DirectCut=C:\Program Files (x86)\mp3DirectCut_2.20\mp3DirectCut.exe"
- for /f "tokens=1,2*" %%a in ('dir /b *.mp3^|%JS% "%~0"') do (
- set "Name=%%c"
- set /a h1=%%a/3600,m1=%%a%%3600/60,s1=%%a%%3600%%60
- set /a h2=%%b/3600,m2=%%b%%3600/60,s2=%%b%%3600%%60
- set /a h1+=100,m1+=100,s1+=100,h2+=100,m2+=100,s2+=100
- setlocal enabledelayedexpansion
- rem set "t1=!h1:~1!:!m1:~1!:!s1:~1!"
- rem set "t2=!h2:~1!:!m2:~1!:!s2:~1!"
- set "t1=!m1:~1!:!s1:~1!"
- set "t2=!m2:~1!:!s2:~1!"
- echo,!t1! !t2! !Name!
- endlocal
- )
- pause & exit/b & rem */
-
- WMP = new ActiveXObject("WMPlayer.OCX");
- s = "";
- while (!WScript.StdIn.AtEndOfStream) {
- f = WScript.StdIn.ReadLine();
- t = WMP.newMedia(f).getItemInfo("Duration");
- t1 = Math.round(t/4);
- t2 = Math.round(t*3/4);
- s += t1 + " " + t2 + " " + f + "\n";
- }
- WScript.StdOut.Write(s);
复制代码 和- @echo off
- set "mp3DirectCut=C:\Program Files (x86)\mp3DirectCut_2.20\mp3DirectCut.exe"
- for %%f in (*.mp3) do (
- echo FILE "%%f"> sh.cue
- echo TRACK 01 AUDIO>>sh.cue
- echo INDEX 01 %1>>sh.cue
- echo TRACK 02 AUDIO>>sh.cue
- echo INDEX 01 %2>>sh.cue
- "%mp3DirectCut%" sh.cue /split C:\Temp
- del C:\Temp\*02.mp3
- )
- del sh.cue
复制代码 怎么让第一个代码调用第二个?里面都有For循环,怕怕....
不循环的话能正常运行的是:- @echo off
- set "mp3DirectCut=C:\Program Files (x86)\mp3DirectCut_2.20\mp3DirectCut.exe"
- echo FILE "C:\test.mp3"> sh.cue
- echo TRACK 01 AUDIO>>sh.cue
- echo INDEX 01 01:10>>sh.cue
- echo TRACK 02 AUDIO>>sh.cue
- echo INDEX 01 03:30>>sh.cue
- "%mp3DirectCut%" sh.cue /split C:\Temp
- del C:\Temp\*02.mp3
-
- del sh.cue
复制代码 你的t1 要替换掉01:10
t2 要替换掉03:30
而遍历的所有mp3文件要替换掉 "C:\test.mp3" |