Mavast
Mavast

Reputation: 9

Batch program not working

I am new to batch coding and I am having an issue where whenever I select an option, it goes to 1 (which is :MEMBERS) even if I enter 2 or 3. I am unsure why this is happening.

    @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

Upvotes: 0

Views: 46

Answers (1)

npocmaka
npocmaka

Reputation: 57252

try with

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

Quotes are also compared in IF conditions.

Upvotes: 2

Related Questions