CODE: [Copy to clipboard]
@echo off&setlocal enabledelayedexpansion
set /p file=请将要处理的文本拖放到这里:
echo.&set /p lie= 待合计的数据所处的列为:
set /a lie-=1
set file=%file:"=%
cd.>temp.vbs
>temp.vbs echo dim sum
>>temp.vbs echo sum=0
>>temp.vbs echo set Fso=createobject^("scripting.filesystemobject"^)
>>temp.vbs echo set fs=Fso.opentextfile^("%file%",1^)
>>temp.vbs echo Do While fs.atEndOfLine ^<^> true
>>temp.vbs echo x=split^(fs.readline,"|"^)
>>temp.vbs echo sum=sum+x^(%lie%^)
>>temp.vbs echo loop
>>temp.vbs echo wscript.echo sum
cscript//nologo temp.vbs
pause