@ESCREAD — Returns text from a file, escapified.

Syntax:
%@ESCREAD[handle,len]

handlemust be a handle returned by @FILEOPEN
lenthe number of bytes to read

Reads text from the file opened as handle, with special characters escapified. Returns **EOF** if you try to read past the end of the file.

If len is not specified, @ESCREAD will read until the next end-of-line. If len is specified, @ESCREAD will read len bytes regardless of any end-of-line characters.

You can use the CESC_CHARS and CESC_FLAGS environment variables to tweak the way text is escapified.

This function calls @FILEREAD internally.

@echo off
rem   Batch file to test @ESCREAD:
setlocal

set handle=%@fileopen[%_batchname,r]

do
   set line=%@escread[%handle]
   if "%line" == "**EOF**" leave
   echo %line``
enddo

set rv=%@fileclose[%handle]
endlocal

See also: @EXPWRITE, which does the reverse.