'== was unexpected at this time

134 Views Asked by At

This problem is probably quite simple, but it has had me stumped for AGES.

Whenever I make a set /p choice in my batch files, it seems to work fine. You type in your command and it goes to whichever command you entered in. But, whenever characters like spaces and >s and |s are accidentally put in, it says (errorentered)'=='(first option)' was unexpected at this time and then the program exits. I am making a game with batch files now and it is a pain if it does something like that. How do I stop it from exiting when there is such an error?

EXAMPLE:
Input: connect a

Output: a'=='help' was unexpected at this time
* program exits *

The code I am working with so far:

    @echo off
    :start
    cls
    color 0a
    echo                            Mandibles Game Hack Tool
    echo ================================================================================
    :blank
    set /p choice= %ipname%]
    if '%choice%'=='help' goto help
    if '%choice%'=='connect' goto connect
    if '%choice%'=='disconnect' goto disconnect
    if '%choice%'=='cls' goto start
    if '%choice%'=='exit' goto exit
    if '%choice%'=='crack' goto crack
    if '%choice%'=='download' goto download
    goto blank

And no, this is nowhere near real hacking. It's just a game.

0

There are 0 best solutions below