@ECHO OFF
SETLOCAL
SET "esc="
SET "normal=%esc%[1;33m"
SET "red=%esc%[1;31m"
SET "green=%esc%[1;32m"
:start
echo hello, are you a Robot?
:choice
echo How do you answer?
set /P c=[%green%Y%normal%/%red%N%normal%]
if /I "%c%" EQU "Y" goto start
if /I "%c%" EQU "N" goto shutdown
goto choice
:shutdown
My normal colour settings are yellow on black. The escape character is well- an escape, however it might be rendered on SO. I use editplus
, which allows control characters to be entered. Other editors may allow this in other ways.
Other than that, it's simply a matter of switching the colours as desired and reverting to normal colours after showing the specials.
I've added a setlocal
so that environment changes are reverted when the batch closes (this is for the general case; yours seems to be set up to exit
)
I've also removed the colons in the goto
statements. The only condition that colons are required here is the specific case of goto :eof
which has a particular meaning.