Right now as the script is written each new system has to be add to
the line of code.
A more efficient way would be if there was a conditional findstr or
find that I could use on the variable %comphtername%
So that if findstr/find “SBO” %computername% goto support_staff
If findstr/find “SBOCC” %computername% goto
service_center_scripts
If findstr/find “DR” %computername% goto disaster_center
%computername%
Rem DRR1P1-DRR1P6
Rem DRR2P1-DRR2P6
Rem DRR3P1-DRR3P6
Rem DRR4P1-DRR4P6
Rem DRR5P1-DRR5P6
Rem DRR6P1-DRR6P6
if DRR1P1==%computername% set PClocation=DRC
if DRR1P2==%computername% set PClocation=DRC
if DRR1P3==%computername% set PClocation=DRC
if DRR1P4==%computername% set PClocation=DRC
.
.
.
if DRR6P6==%computername% set PClocation=DRC
rem SB0CCR1P1 – SB0CCR1P6
rem SB0CCR2P1 – SB0CCR2P6
rem SB0CCR3P1 – SB0CCR3P6
rem SB0CCR4P1 – SB0CCR4P6
rem SB0CCR5P1 – SB0CCR5P6
if SBOCCR1P1==%computername% set PClocation=SBOCC
if SBOCCR1P2==%computername% set PClocation=SBOCC
if SBOCCR1P3==%computername% set PClocation=SBOCC
if SBOCCR1P4==%computername% set PClocation=SBOCC
if SBOCCR1P5==%computername% set PClocation=SBOCC
.
.
.
if SBOCCR1P1==%computername% set PClocation=SBOCC
rem TDB
if SBODIR==%computername% goto endofb
rem KSJ
if SBODEV1==%computername% goto endofb
rem CPK
if SBODEV2==%computername% goto endofb
rem SHK
if SBOINT1==%computername% goto endofb
rem RJB
if SBOINT2==%computername% goto endofb
rem DCG
if SBOINT3==%computername% goto endofb
rem JRB
if SBOSUP1==%computername% goto endofb
rem MS
if SBOMGR1==%computername% goto start_printer_services
Thanks in advance
You can compare the fixed part directly
if "%computername:~0,2%" EQU "DR" set "PClocation=DRC"&^
goto support_staff
if "%computername:~0,3%" EQU "SBOCC" set "PClocation=SBOCC"&^
goto service_center_scripts
...and so on
The tilde as last char is a line continuation char,
you can put the goto on the same line instead.
HTH
Matthias