1

我已经设置了一个自定义批处理文件来安装游戏服务器。但问题是当您提供响应时它会关闭。它使用多个 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
)
)
4

1 回答 1

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
于 2013-01-31T04:29:16.610 回答