win7 系统 可试 POWERSHELL- cat .\b.txt|measure-object -average
复制代码 非要BAT处理的话 那就加JS吧cript- @if(0)==(0) echo off
- CScript.exe -NoLogo -E:JScript %0 < "b.txt"
- pause&exit
- @end
- var text = WSH.StdIn.ReadAll().split('\r\n');
- var len = text.length;
- var cnt = 0;
- for (var i = 0; i < len; i++) {
- var j = +text[i];
- cnt += j;
- }
- var avg = cnt / len;
- WSH.echo(avg)
复制代码
|