Reputation: 3
I want to make it so the users will be able to change the colors while in the program
@echo off
echo -0 Black
echo -1 Blue
echo -2 Green
echo -3 Aqua
echo -4 Red
echo -5 Purple
echo -6 Yellow
echo -7 White
echo -8 Gray
echo -9 Light Blue
echo -a Light Green
echo -b Light Aqua
echo -c Light Red
echo -d Light Purple
echo -e Light Yellow
echo -f Bright White
set /p -=
echo |0 Black
echo |1 Blue
echo |2 Green
echo |3 Aqua
echo |4 Red
echo |5 Purple
echo |6 Yellow
echo |7 White
echo |8 Gray
echo |9 Light Blue
echo |a Light Green
echo |b Light Aqua
echo |c Light Red
echo |d Light Purple
echo |e Light Yellow
echo |f Bright White
set /p |=
color %-%%|%
pause`
So I type zero (0) to test it out and it tells me it is not a recognized command... It shouldn't do that though because it is /set p. Also the "color %-%%|%" at the end i know is not correct so I also need help with the proper format for that it is supposed to be the first input and the last input together to make the correct color and background code.
Upvotes: 0
Views: 60
Reputation: 67226
The names of Batch variables must start with letter and can not contain special characters, like |
. May I propose a different approach?
@echo off
color /? | findstr "="
set /P "fore=Enter foreground color: "
set /P "back=Enter background color: "
color %back%%fore%
pause
Upvotes: 0
Reputation: 1061
I assume that background color is not changing, and you want to change foreground color by entering the color code.
@echo off
echo -0 Black
echo -1 Blue
echo -2 Green
echo -3 Aqua
echo -4 Red
echo -5 Purple
echo -6 Yellow
echo -7 White
echo -8 Gray
echo -9 Light Blue
echo -a Light Green
echo -b Light Aqua
echo -c Light Red
echo -d Light Purple
echo -e Light Yellow
echo -f Bright White
echo.
set /p color=Enter the color code:
color 0%color%
echo.
pause
Upvotes: 1