@LINES[filename]:  Returns the line number of the last line in the file, or "-1" if the file is empty. The first line in the file is numbered 0, so (for example) @LINES will return 0 for a file containing one line. To get the actual number of lines, use %@INC[%@LINES[filename]].

 

The filename must be in quotes if it contains white space or special characters.

 

@LINES must read each line of the file in order to count it, and will therefore cause significant delays if used on a large file.

 

@LINES can count lines in file streams on NTFS drives if the stream name is specified. See NTFS File Streams for additional details on file streams.

 

@LINES supports the TCC-RT clipboards (CLIP0: - CLIP9:) and temporary files (TMP0: - TMP9:).

 

@LINES also sets two variables:

 

%_LINES_MAXLENThe length of the longest line (in characters)
%_LINES_MAXLOCThe line number (base 0) of the longest line

 

Example:

 

echo %@lines[readme.txt]

170