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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
nnnmmm
Posts: 141
Joined: 26 Aug 2017 06:11

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

#1 Post by nnnmmm » 05 Jul 2024 03:04

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.

Lucky4Me
Posts: 24
Joined: 21 Oct 2020 06:33

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

#2 Post by Lucky4Me » 05 Jul 2024 03:39

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

T3RRY
Posts: 250
Joined: 06 May 2020 10:14

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

#3 Post by T3RRY » 05 Jul 2024 04:34

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

nnnmmm
Posts: 141
Joined: 26 Aug 2017 06:11

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

#4 Post by nnnmmm » 05 Jul 2024 05:53

<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

Lucky4Me
Posts: 24
Joined: 21 Oct 2020 06:33

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

#5 Post by Lucky4Me » 05 Jul 2024 07:29

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.

Post Reply