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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
tanoloco
Posts: 1
Joined: 20 Jan 2009 07:35

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

#1 Post by tanoloco » 20 Jan 2009 08:07

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

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

#2 Post by jeb » 20 Jan 2009 09:20

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

Post Reply