Page 1 of 1

How to block the first or the last line of the output screen

Posted: 20 Jan 2009 08:07
by tanoloco
Hello,

I created a simple batch program in which I realized a for cycle which on each cycle creates one or more output lines.

Of course in this way the new outputted lines will push the previous lines out of the output screen.

I would like to know how can I block the first line of the output screen to keep for example a title or the name of the program running, and the last line of the output screen to keep a menu of the command.

I think I saw it sometimes but I don't know of to realize it.

Example:
LINE NUMBER..state..................output
first................FIXED................TITLE
lines...............push previous.....ECHO
lines...................^...................ECHO
lines...................^...................ECHO
lines...................^...................ECHO
lines...................^...................SOME EMPTY ONES
lines...................^...................SOME EMPTY ONES
lines...................^...................SOME EMPTY ONES
last..................FIXED...............MENU

Any help?
Thank you in advance

Posted: 20 Jan 2009 09:20
by jeb
Hi tanoloco,

similiar to the Problem from ntyReader, but a bit easier, because of the fixed count of one line removing from the tail and the head.

Code: Select all

@ECHO off
setlocal ENABLEDELAYEDEXPANSION

set /a show=0
for /F "tokens=* skip=1" %%r in (test.txt) do (
  if !show!==1 echo !saveLine!
  set "saveLine=%%r"
  set /a show=1
)



jeb