Command Prompt for Windows




READLN Example

Consider the following batch file :-

@ECHO OFF
SET calc=0
READLN %1
FOR %%i is 1 TO %readln% DO {
	READLN %1 %%i
	IF NOT "%readln%"=="" CALC %calc%+%readln%
}
ECHO Total is %calc%

This batch file will sum a list of numbers contained in a text file, that has been specified at the command prompt. Blank lines are ignored and one number per line is assumed.