Page 1 of 1
Last Line of a CMD window
Posted: 08 Sep 2022 06:35
by hivebluet
I was wondering about this ever since I started to learn about batch programming. As you see in the screenshot I have provided, I have set the console window to
30 cols wide and
10 cols high, and
I've echoed 10 lines and did `
pause >nul` after that. But the first line seems to have disappeared? I think
pause >nul OR the cursor is causing this, but is there any actual way to pause the script without making a new line? Thanks to everyone who helps.
Re: Last Line of a CMD window
Posted: 08 Sep 2022 10:07
by Aacini
Yes. Your problem is not caused by the
pause command, but by the last
echo 10 that advance the cursor to new line.
To show text with no CR+LF at end, use:
Code: Select all
set /P "=This text leaves cursor in same line" < NUL
But be aware that any leading space (or control character) in the text will be supressed...
For example, in your code:
PS - In future questions do
not post code (or data) in an image. Instead, enclose the code between
[code] and
[/code] tags (lines).
Re: Last Line of a CMD window
Posted: 22 Sep 2022 12:10
by hivebluet
Thanks for your advice!