Solved make a command for unkown code (wildcard)

July 25, 2014 at 09:27:01
Specs: Windows 7
i want to make code "if" for my batch,
i want to make "if" code for exit
but it was wild card

example:
if %LABEL% == y exit /b
this is a code for exit with Known code
how do i make it to be a wildcard

if %LABEL% == y goto home
if %LABEL% == n goto credits

and if i have lists known codes like above, can i make another to be wild card? (for other unknown codes)

if %LABEL% == * == exit /b
that * was a wildcard symbol, but it's wrong, can you make that line command BUT change the * to be the wildcard code that cmd could read as wildcard WITHOUT bothering the other lists code?

NB: this is the 2nd batch i make, and iam a newbie / beginner (in fact, i make batch file with copy from the other script from the internet, and then edit it a little), if you know the real name for "code" tell me, too.

anyway, thanks :)


See More: make a command for unkown code (wildcard)

Report •


#1
July 25, 2014 at 10:13:56
✔ Best Answer
fsfc:
if %LABEL% == y goto home
if %LABEL% == n goto credits
if %LABEL% == * == exit /b

Let me convert your logic to broken English.
Test to see if input is "y." If so, goto "home."
Test to see if input is "n." If so, goto "credits."
Test to see if input is anything. If so, exit.

Well, that last line could be simplified to just exit, couldn't it?

if %LABEL% == y goto home
if %LABEL% == n goto credits
exit /b

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question