@echo off
echo.
echo (backgroundColor_textColor)
echo set color (Blue_White or Red_White)
echo.
set COLOR=
set /p COLOR = choose color from the color given:
if "%COLOR%"=="blue_white" goto bw
if "%COLOR%"=="blue white" goto bw
if "%COLOR%"=="Blue_White" goto bw
if "%COLOR%"=="Blue White" goto bw
if "%COLOR%"=="BW" goto bw
if "%COLOR%"=="bw" goto bw
if "%COLOR%"=="red_white" goto rw
if "%COLOR%"=="red white" goto rw
if "%COLOR%"=="Red_White" goto rw
if "%COLOR%"=="Red White" goto rw
if "%COLOR%"=="RW" goto rw
if "%COLOR%"=="rw" goto rw
:bw
color 1f
goto start
:rw
color 4f
:start
pause
echo.
pause
答案 0 :(得分:1)
正如评论中提到的那样,您的问题是set
命令中的空格。它应该是这样的:
set /p COLOR=choose color from the color given:
以下是您的脚本的“工作”版本:
@echo off
echo.
echo (backgroundColor_textColor)
echo set color (Blue_White or Red_White)
echo.
set COLOR=
set /p COLOR=choose color from the color given:
if "%COLOR%"=="blue_white" goto bw
if "%COLOR%"=="blue white" goto bw
if "%COLOR%"=="Blue_White" goto bw
if "%COLOR%"=="Blue White" goto bw
if "%COLOR%"=="BW" goto bw
if "%COLOR%"=="bw" goto bw
if "%COLOR%"=="red_white" goto rw
if "%COLOR%"=="red white" goto rw
if "%COLOR%"=="Red_White" goto rw
if "%COLOR%"=="Red White" goto rw
if "%COLOR%"=="RW" goto rw
if "%COLOR%"=="rw" goto rw
:bw
color 1f
goto start
:rw
color 4f
:start
pause
echo.
pause