批处理程序不起作用

时间:2015-12-17 16:09:26

标签: batch-file

我是批处理编码的新手,我遇到了一个问题,即每当我选择一个选项时,即使我输入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

1 个答案:

答案 0 :(得分:3)

尝试

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

报价也会在IF条件下进行比较。