0

I need to write a .bat file, which lets a person to choose from several different options.

 @echo off
 echo how are you doing today?
 :meniu
 echo Meniu
 echo ------------------------
 echo 1.Good
 echo 2.Bad
 choice/C:12 /N
 if errorlevel==255 goto error
 if errorlevel==1 goto good
 if errorlevel==2 goto bad
 :good
 echo have a nice day
 goto end
 :bad 
 echo i hope you'll get better soon
 goto end
 :end

When the user makes a choice, I want to change the text colour (lets say if choice is good, the text colour will be yellow, if bad - red). How do you change the text colour, starting after the input prompt, without changing the colour of what is already on the console?

IInspectable
  • 46,945
  • 8
  • 85
  • 181
  • you want to change the colors per line or for entire console? – npocmaka Oct 24 '15 at 13:27
  • Only the text that goes in the section :bad and :good to be in different colors –  Oct 24 '15 at 13:29
  • 5
    possible [duplicate](http://stackoverflow.com/q/4339649/2152082) – Stephan Oct 24 '15 at 13:37
  • A very Robust Color option was written Carlos over on DosTips.com. http://www.dostips.com/forum/viewtopic.php?p=41155#p41155 – Squashman Oct 24 '15 at 14:13
  • 1
    Your `if` queries will not work: either write `if %ErrorLevel%==1`, or use `if ErrorLevel 1` meaning *if ErrorLevel>=1*; if you go for the 2nd option, you will need to sort them in descending order... – aschipfl Oct 24 '15 at 18:52

1 Answers1

-1

You can't change only certain colors, but you can do cls then color [color]. Also, instead of doing choice/C:12 /N you can do set /p mood= then do if %mood% == 1 goto good and if %mood% == 2 goto bad with goto meniu underneath it.

J Whit
  • 1
  • 2