制作一个蝙蝠文件,询问我想玩什么游戏

时间:2014-10-31 13:58:10

标签: batch-file

我的想法是让它在电脑启动时启动,然后问我想玩什么游戏。这很简单,但我希望能够回答不同的答案,例如:输入是CS:GO,cs,csgo,反击等等,这里是我尝试做的方式=

if %game%==1,CS:GO,cs:go,csgo,"Counter Strike","counter strike" goto cs

但是你可能知道,它没有用。所以问题是如何使它成为"%game%"可以是很多不同的东西,并且如果%GAME%== ......仍然可以进行相同的事情而不必进行乘法?

如果您想看到它=

,请输入整个代码
@echo off
color a
cls
:start
echo what game do you want to play?
echo 1/"CS:GO"? -"Counter Strike: Global Ofensive"
echo 2/"H&G"? -"Heros & Generals"
echo 3/"P2"? -"Portal 2"
echo 4/"UT"? -"Unturned"
echo 5/"LO"? -"Loadout"
echo 6/"DAB"? -"Double Action Boogaloo"
set /p game=vwhat game?:
if %game%==1,CS:GO,cs:go,csgo,"Counter Strike","counter strike" goto cs
pause
goto start

1 个答案:

答案 0 :(得分:0)

:start
echo what game do you want to play?
echo 1/"CS:GO"? -"Counter Strike: Global Ofensive"
echo 2/"H&G"? -"Heros & Generals"
echo 3/"P2"? -"Portal 2"
echo 4/"UT"? -"Unturned"
echo 5/"LO"? -"Loadout"
echo 6/"DAB"? -"Double Action Boogaloo"
set /p game=what game?: 
echo /1/CS:GO/csgo/Counter Strike/ |find /i "/%game%/">nul && goto cs
rem other games here...
pause
goto start

/i使find不区分大小写,因此它会找到CSGO,CsGo,cSgO,......

&&作为“如果上一个命令(find)成功,则......”