本帖最后由 pcl_test 于 2016-3-26 21:24 编辑
- //&cls&dir /b *.mp3|cscript -nologo -e:jscript "%~f0"&pause&exit
-
- function addZero(n){return n<10?'0'+n:n}
-
- function formatSum(t){
- var r = t.split('.');
- r[1]=r[1]?r[1]:'0'
- var hour = parseInt(r[0]/3600);
- var minute = parseInt((r[0]-hour*3600)/60);
- var second = parseInt((r[0]-hour*3600)%60);
- return addZero(hour)+':'+addZero(minute)+':'+addZero(second)+'.'+r[1]
- }
-
- var s=0, wo = new ActiveXObject('WMPlayer.OCX');
- while (!WScript.StdIn.AtEndOfStream){
- var f = WScript.StdIn.ReadLine();
- var t = wo.newMedia(f).GetItemInfo("Duration");
- //WScript.StdOut.WriteLine(f+'|'+t);
- s = Number((s+parseFloat(t)).toFixed(3));
- }
- WScript.StdOut.WriteLine(formatSum(s.toString()));
复制代码
|