Oops! In my haste to post, (trying tobeat Shawn ) missed second requirement.
code:

Break on
$count = 0
$FileName = "C:\boot.ini"
$ResultFile = "C:\Result.txt"
IF Open(1, $FileName) = 0
$x = ReadLine(1)
WHILE @ERROR = 0
$count = $count + 1
? "Line number " + $count + " reads: [" + $x + "]"
$x = ReadLine(1)
LOOP
ENDIF
Close(1)

IF Open(2, $ResultFile,5) = 0

$x = WriteLine( 2 , "File " + $FileName + " has " + $count + " lines" + Chr(13) + Chr(10) )
ELSE
BEEP
? "failed to open file, error code : [" + @ERROR + "]"
ENDIF

get $


_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.