Page 1 of 1

is there a way to use ECHO <esc>[32;40m without adding an extra line?

Posted: 05 Jul 2024 03:04
by nnnmmm
ECHO [32;40m=================
ECHO Quake 4 - selector
ECHO =================
the line is offset, it is hard to read and compare the batch lines between up and down

----------------------------------------------
ECHO [32;40m
ECHO =================
ECHO Quake 4 - selector
ECHO =================
this is what i want but WITHOUT adding a line

ECHO <esc>[32;40m
ECHO [32;40m
is there a way to achieve the effect?
simply using [32;40m without ECHO kind of worked but i am not sure if i have to use the command NUL to remove the error message.

Re: is there a way to use ECHO <esc>[32;40m without adding an extra line?

Posted: 05 Jul 2024 03:39
by Lucky4Me
You can try the following?

Code: Select all

@echo off
cls
call :necho "[32m" "=================="
call :necho "[36m" "Quake 4 - selector"
call :necho "[32m" "=================="
exit /b
:necho
set "txt=%~1%~2[0m"
echo %txt%
exit /b
Make sure that the color and the txt is between "", then the color becomes %~1 and the txt becomes %~2

Re: is there a way to use ECHO <esc>[32;40m without adding an extra line?

Posted: 05 Jul 2024 04:34
by T3RRY
nnnmmm wrote:
05 Jul 2024 03:04

Code: Select all

ECHO [32;40m
ECHO =================
ECHO Quake 4 - selector
ECHO =================
this is what i want but WITHOUT adding a line

Code: Select all

<nul Set /P "=[32;40m"
ECHO =================
ECHO Quake 4 - selector
ECHO =================
One simple solution

Re: is there a way to use ECHO <esc>[32;40m without adding an extra line?

Posted: 05 Jul 2024 05:53
by nnnmmm
<nul Set /P "=[32;40m"
was so good, thanks

how can <nul make the prompt disappear?
nul i know makes an imaginary file you dump things into it without causing anything

a reason i need [32;40m instead of color 0A was
i have two types of 100s batch files
one goes with" Press any other key to CONTINUE"
the other goes "Press any other key to QUIT"

it takes some energy out of me to locate these words to identify which one CONTINUE or QUIT
but if a QUIT batch has a little bit of color somewhere(a whole color 0A sends a little shock to my head because not used to a whole), i can use my peripheral vision to identify it in no time

Re: is there a way to use ECHO <esc>[32;40m without adding an extra line?

Posted: 05 Jul 2024 07:29
by Lucky4Me
one goes with" Press any other key to CONTINUE"
the other goes "Press any other key to QUIT"
Maybe you can adjust your txt to

Code: Select all

echo Press any other key to [32mCONTINUE[0m
Then CONTINUE will be green and the rest will have the default color.