Batch Help: IF multiple variables

chaos945

OSNN Senior Addict
Joined
Feb 10, 2003
Messages
934
#1
Anyone know how to seperate variables in a single string. The red designates the spot the command needs to go but I can't get it to work.

ie. IF /I "%USER_INPUT%"=="1"^"ONE" GOTO ONE
 

j79zlr

Glaanies script monkey
Political User
Joined
Feb 16, 2003
Messages
2,725
#2
Why not

IF /I "%USER_INPUT%"=="1" GOTO ONE
IF /I "%USER_INPUT%"=="ONE" GOTO ONE
 

chaos945

OSNN Senior Addict
Joined
Feb 10, 2003
Messages
934
#3
I want it all on one string, because I'm picky. Plus I can then assign an entire section of commands in just one IF statement. That is actually how it is right now but it makes the code bloated since I have like 7 menus and 7*3=21 possible inputs.

ie.
running say this:
Code:
IF "%RUNNING_LOOP%"=="1"[color=red]^[/color]"ONE" (
		SET /A RUNNING_LOOP=%RUNNING_LOOP%+1
		ECHO %USER_INPUT% is not a valid response
		)
compared to this:
Code:
IF "%RUNNING_LOOP%"=="ONE" (
		SET /A RUNNING_LOOP=%RUNNING_LOOP%+1
		ECHO %USER_INPUT% is not a valid response
		)
IF "%RUNNING_LOOP%"=="1" (
		SET /A RUNNING_LOOP=%RUNNING_LOOP%+1
		ECHO %USER_INPUT% is not a valid response
		)
Another way I could get around doing this is assigning somewhere for the IF statement to GOTO and then just make them common, but after a while of doing this the hierarchy turns into absolute hell.

Code:
IF "%RUNNING_LOOP%"=="ONE" GOTO START
IF "%RUNNING_LOOP%"=="1" GOTO START
:START
	SET /A RUNNING_LOOP=%RUNNING_LOOP%+1
	ECHO %USER_INPUT% is not a valid response

:LINE2

:LINE3

:LINE4
	ECHO Think of a few pages of these lines and you see what I mean by hell.
 

Geffy

OSNN Veteran Addict
Joined
Mar 18, 2002
Messages
7,805
#4
can you use OR or || to do that or something, I dont really know much about batch jobs though, so if this is the dumbest suggestion ever then please dont tell me :p
 

Members online

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Hey ep!

All good with me, applying for microsoft mvp right now, should have done this a while ago.

Notifications don't work, I only found your response by comming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier, mine is perriscalderon at gmail
Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...

Forum statistics

Threads
62,030
Messages
673,542
Members
89,041
Latest member
brandixtblook