Placing two netbios name on the same line

L

Larry

During a script I would like to jump to a label if the %computername% is:

i.e.


if %computername% EQU server1 or server2 goto label


my question is how to format the server1 or server2 part in one line.

thx again all...

Larry
 
A

Al Dunbar [MS-MVP]

Larry said:
During a script I would like to jump to a label if the %computername% is:

i.e.


if %computername% EQU server1 or server2 goto label


my question is how to format the server1 or server2 part in one line.

for %%F in (server1 server2) do if /i "%computername%" EQU "%%F" goto:label


/Al
 
M

Matthias Tacke

Larry said:
During a script I would like to jump to a label if the %computername% is:
i.e.
if %computername% EQU server1 or server2 goto label

my question is how to format the server1 or server2 part in one line.
thx again all...

Couldn't wait yesterday Larry :)

I like Al's way. An old fashioned one is:

If /I "%computername%" EQU "server1" (
goto label
) else (
If /I "%computername%" EQU "server2" goto label
)

The quoting is to prevent errors in case of empty vars. The /I to ignore
case.
 
L

Larry

Matt, thx for your help, you are good. Anyway, I am just trying to survive
out here...

Thx again, Larry
 
A

Al Dunbar [MS-MVP]

Larry said:
Matt, thx for your help, you are good. Anyway, I am just trying to survive
out here...

Thx again, Larry

I prefer your way, but he wanted it all in one line...

/Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top