Batch File %COMPUTERNAME%

  • Thread starter Thread starter Dre'
  • Start date Start date
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!
 
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
 
Back
Top