2015-01-04 61 views
0

试图让程序运行多人合作社,但我的批处理脚本不能正常工作,我认为我大量的搞砸了。试图让一个朋友来帮忙,结束了这个,它根本不工作,我失去了所有的进步。有人能告诉我这里出了什么问题,或者纠正它吗?为什么IF/ELSE命令不能在我的批处理代码中工作?

:hostmpcoop 
set /p files="(Optional) Enter stuff to run spaced by -file : " 
set /p playercount="Enter number of desired players: " 
if "%files%"=="" (
    echo No files entered. 
    if not "%playercount%" == "" (
     echo Running vanilla MP 
     thing.exe -host %playercount% 
    )else(
     echo You need to specify a playercount! 
     goto hostmpcoop 
    ) 
) 
if not "%files%"=="" (
    if not "%playercount%"=="" (
     thing.exe -host %playercount% -file %files% 
    )else(
     echo You need to specify a playercount! 
     goto hostmpcoop 
    ) 
) 
if "%files%"==""(
    if "%playercount%"=="" (
     echo "Enter a player count!" 
     goto hostmpcoop 
    ) 
) 
goto home 

回答

1

你需要周围括号的空间,当别的,如果是用于:

:hostmpcoop 
set /p files="(Optional) Enter stuff to run spaced by -file : " 
set /p playercount="Enter number of desired players: " 
if "%files%"=="" (
    echo No files entered. 
    if not "%playercount%" == "" (
     echo Running vanilla MP 
     thing.exe -host %playercount% 
    ) else (
     echo You need to specify a playercount! 
     goto hostmpcoop 
    ) 
) 
if not "%files%"=="" (
    if not "%playercount%"=="" (
     thing.exe -host %playercount% -file %files% 
    ) else (
     echo You need to specify a playercount! 
     goto hostmpcoop 
    ) 
) 
if "%files%"=="" (
    if "%playercount%"=="" (
     echo "Enter a player count!" 
     goto hostmpcoop 
    ) 
) 

转到家里

相关问题