[windows2000] Re: String Comparison in CMD or BAT script?

  • From: "Greg Reese" <GReese@xxxxxxxxxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Tue, 30 Dec 2003 09:29:45 -0500

does LEFT(%computername%,4) do anything?
 
Greg
 
 

-----Original Message-----
From: windows2000-bounce@xxxxxxxxxxxxx 
[mailto:windows2000-bounce@xxxxxxxxxxxxx]On Behalf Of Robert K Coffman Jr - 
Info From Data Corporation
Sent: Tuesday, December 30, 2003 9:22 AM
To: windows2000@xxxxxxxxxxxxx
Subject: [windows2000] String Comparison in CMD or BAT script?


Anyone have an elegant solution to this?
 
I have a series of servers, all beginning with the same 4 letter string.  I'd 
like to check for the first 4 letters, rather than the entire string.  In other 
words, how can I do a LEFT$ in a script?
 
current solution that blows:
 
if '%computername%' == 'TCCA01' goto skip_notice
if '%computername%' == 'TCCA02' goto skip_notice
etc....
 
Thanks for any assistance.
 
- Bob Coffman

Other related posts: