Reputation: 11
sometimes I use "dir | more" command from a cmd window and I see all contents of a folder, a screen once a time. now, my subroutine (it's a simple cycle FOR), shows data from a file TXT with a series of "echo"s.
since data is much more of 25 lines, since I don't want to use vertical scroll bar, how do I can do a "more"-like command, that allows correct paging of output, considering number lines available in cmd customized window?
thanks a lot
Upvotes: 0
Views: 1270
Reputation: 1705
Agree with rojo, the solution is as simple as his comment. Without further information (only guessing) if you want to control lines echoed, something like this may be a good starting point.
@echo off
setlocal EnableExtensions EnableDelayedExpansion
echo Calling Powershell, wait...
for /F "usebackq tokens=1-4 delims=, " %%1 in (`powershell -Command "write-host $host.ui.rawui.BufferSize,$host.ui.rawui.WindowSize;"`) do set/a bufCols=%%1, bufLines=%%2, winCols=%%3, winLines=%%4
set/a cnt=0, winLines-=1
for /f "tokens=*" %%a in (input.txt) do (
set/a cnt+=1, pauser=cnt%%winLines
echo %%a
if !pauser! equ 0 pause
)
endlocal
exit/B
Upvotes: 1