我已设置自定义批处理文件来安装游戏服务器。但问题是,当你提供回复时,它会关闭。它使用多个IF语句。
set /P input6=Would you like a custom loadout (Y/N):
if %input6%==Y (
echo ---------------------------
echo Default
echo Survival
echo PvP
echo ---------------------------
set /P input7=Which one:
if %input7%==Default (
perl db_utility.pl [] ["DZ_Patrol_Pack_EP1",[[],[]],[[],[]]]
goto package
)
if %input7%==Survival (
perl db_utility.pl [["ItemMap","ItemCompass","ItemMatchbox","FoodCanBakedBeans","ItemKnife","FoodCanBakedBeans"],["ItemTent","ItemBandage","ItemBandage"]] ["DZ_Patrol_Pack_EP1",[[],[]],[[],[]]]
goto package
)
if %input7%==PvP (
perl db_utility.pl [["Mk_48_DZ","NVGoggles","Binocular_Vector","M9SD","ItemGPS","ItemToolbox","ItemCompass","FoodCanBakedBeans","ItemMap","ItemWatch"],[["100Rnd_762x51_M240",47],"ItemPainkiller","ItemBandage","15Rnd_9x19_M9SD","100Rnd_762x51_M240","ItemBandage","ItemBandage","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemMorphine"]] ["DZ_Backpack_EP1",[[],[]],[[],[]]]
goto package
)
)
答案 0 :(得分:2)
当我运行您的批处理文件时,我收到此错误:
( was unexpected at this time.
当我减少打开和关闭括号之间的脚本行数时,脚本可以正常工作。所以我认为你需要重组批处理文件,并避免使用嵌套的if
结构。尝试这样的事情:
set /P input6=Would you like a custom loadout (Y/N):
echo input6 is %input6%
if not "%input6%"=="Y" goto done
echo input6 is %input6%
echo ---------------------------
echo Default
echo Survival
echo PvP
echo ---------------------------
set /P input7=Which one:
if %input7%==Default (
perl db_utility.pl [] ["DZ_Patrol_Pack_EP1",[[],[]],[[],[]]]
goto package
)
if %input7%==Survival (
perl db_utility.pl [["ItemMap","ItemCompass","ItemMatchbox","FoodCanBakedBeans","ItemKnife","FoodCanBakedBeans"],["ItemTent","ItemBandage","ItemBandage"]] ["DZ_Patrol_Pack_EP1",[[],[]],[[],[]]]
goto package
)
if %input7%==PvP (
perl db_utility.pl [["Mk_48_DZ","NVGoggles","Binocular_Vector","M9SD","ItemGPS","ItemToolbox","ItemCompass","FoodCanBakedBeans","ItemMap","ItemWatch"],[["100Rnd_762x51_M240",47],"ItemPainkiller","ItemBandage","15Rnd_9x19_M9SD","100Rnd_762x51_M240","ItemBandage","ItemBandage","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemMorphine"]] ["DZ_Backpack_EP1",[[],[]],[[],[]]]
goto package
)
:done