Batch File %COMPUTERNAME%

D

Dre'

I need to create a batch file that looks at the first "5" characters
of
a %COMPUTERNAME% to determine where to go in a batch file.

ie. if $COMPUTERNAME% == PC-AD-xxx goto load99

if %COMPUTERNAME% == %COMPUTERNAME% works for all computer names but I
would like to select a subset of computer names to run the batch file.

Is there a wildcard or syntax for this scenario?

Thanks in advance!
 
J

Jerold Schulman

I need to create a batch file that looks at the first "5" characters
of
a %COMPUTERNAME% to determine where to go in a batch file.

ie. if $COMPUTERNAME% == PC-AD-xxx goto load99

if %COMPUTERNAME% == %COMPUTERNAME% works for all computer names but I
would like to select a subset of computer names to run the batch file.

Is there a wildcard or syntax for this scenario?

Thanks in advance!


If /i "%Compuername:~0,5%" EQU "PC-AD" goto load99


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 

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