Learn how to a build a cloud-first strategyRegister Now


VB Script doing a like comparison

Posted on 2014-08-20
Medium Priority
Last Modified: 2014-08-20
Hi Guys,

I am making a little network tool. I am looping through the network adapters. I would like to do a like comparison

So if I get an adapter that is named (local area connection) I want to know it even if it is called "local area connection 1" or local area connection 2 etc.

so something like

if adapter.Name like '%local area connection%' then.

I know that is SQL and it cant be done the same way. but how do I do that?
Question by:tim_carter
  • 2
LVL 28

Accepted Solution

omgang earned 2000 total points
ID: 40274199
Vbscript Instr Function.


intFound = InStr(adapter.Name, "local area connection")
If intFound <> 0 Then

OM Gang

Author Closing Comment

ID: 40274221
Thanks works great. Just have to take into account upper and lowercase
LVL 28

Expert Comment

ID: 40274238
See the MSDN article.  The InStr function defaults to binary comparison but you can for text comparison so upper/lower case will match.

intFound = InStr(1, adapter.Name, "local area connection", 1)

OM Gang

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses
Course of the Month21 days, 3 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question