2015-12-17 65 views
0

我是批量編碼的新手,我遇到了一個問題,即當我選擇一個選項時,即使輸入2或3,它也會到1(即:成員)。我不確定這是爲什麼發生。批處理程序不能正常工作

@echo off 
    cls 
    color A 
    :MENU 
    cls 
    echo =============================== 
    echo Mavast Client v0.01 
    echo =============================== 
    echo Enter a number from the list and hit enter 
    echo to run that program. 
    echo 1. Members 
    echo 2. Support us 
    echo 3. Exit 
    set /p var= Run: 
    if %var%=="1" goto MEMBERS 
    if %var%=="2" goto SUPPORT 
    if %var%=="3" goto EXIT 



    :MEMBERS 
    cls 
    echo Owner/Rifler = C0MpL3T3 
    echo Admin/Stratcaller = TDGR (The Dutch Grim Reaper) 
    echo Awper = NONE 
    echo Lurker = NONE 
    echo Entry Fragger = NONE 
    echo press any key to continue 
    timeout -1 > NUL 
    goto MENU 

    :SUPPORT 
    cls 
    echo Support us by donating BitCoins or skins 
    echo to donate skins, just trade them to TDGR or C0MpL3T3. 
    echo to donate bitcoins, send any amount you want to this address: 
    echo 1DSRHe7L842MZjwTWYPzgGzbsZ8zU97w9g 
    echo thank you! 
    echo press any key to continue 
    timeout -1 > NUL 
    goto MENU 

    :EXIT 
    cls 
    exit 
+4

可能重複[批處理if語句不工作](http://stackoverflow.com/questions/14207952/batch-if-statements-not-working) –

+0

也許你會發現一些有用的提示[本答案](http ://stackoverflow.com/a/34301281/5047996)我最近發佈了......無論如何,請將問題標題更改爲比_Batch程序不工作更具體的內容! – aschipfl

回答

3

嘗試

if "%var%"=="1" goto MEMBERS 
if "%var%"=="2" goto SUPPORT 
if "%var%"=="3" goto EXIT 

行情也在IF條件進行比較。