Silly
Silly

Reputation: 227

Covering text in batch files

Is there a way to "cover text" so like this: I echo out "Hello world" but now I want to have it say "Pie is good" so I need it to print over it. I can not use cls because it flickers.

Edit:

I need to use lots of echos that I need it to start the text back at "0, 0,".

Upvotes: 0

Views: 78

Answers (2)

RGuggisberg
RGuggisberg

Reputation: 4750

This is based on jeb's post at progress % within same line without cls.

@echo off
cls
setlocal EnableDelayedExpansion
call :BL.String.CreateCR

<nul set /p "=Hello world!CR!"
REM I will delay here so we can see it work.  You will do other processing
ping -n 2 127.0.0.1 > nul
<nul set /p "=Pie is good"
ping -n 2 127.0.0.1 > nul
echo.
pause
exit /b

:BL.String.CreateCR
::: CR should  be used only with DelayedExpansion
for /F "usebackq" %%a in (`copy /Z "%~dpf0" nul`) DO (
   set "cr=%%a"
)
exit /b

Upvotes: 2

Knuckle-Dragger
Knuckle-Dragger

Reputation: 7046

You could print a full page.

@ECHO OFF
ECHO ###############################################################################
ECHO #
ECHO # Hello World
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO ###############################################################################
PAUSE
ECHO ###############################################################################
ECHO #
ECHO # Pie is Good
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO #
ECHO ###############################################################################
PAUSE

Upvotes: 1

Related Questions