computing
  • 1

Solved VBS: How To Make Instr Ignore Case?

  • 1

I’m using a vb script – here’s my script:

const ForReading = 1

Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objFile1 = objFSO.OpenTextFile(“whitelist”, ForReading)

strCurrentDevices = objFile1.ReadAll
objFile1.Close

Set objFile2 = objFSO.OpenTextFile(“ntbtlog.txt”, ForReading)

Do Until objFile2.AtEndOfStream
strAddress = objFile2.ReadLine
If InStr(strCurrentDevices, strAddress) = 0 Then
strNotCurrent = strNotCurrent & strAddress & vbCrLf
End If
Loop

objFile2.Close

Wscript.Echo “Entries which are not on the whitelist will appear in output.txt”

Set objFile3 = objFSO.CreateTextFile(“output.txt”)

objFile3.WriteLine strNotCurrent
objFile3.Close

How do I make the “instr” comparison ignore case-sensetivity?

Thanks!

Share

1 Answer

  1. you can do case insensitive using Instr’s vbTextCompare,

    If InStr(1,strLine,"word",1) > 0 Then
    		WScript.Echo "Found"
    End If 
    

    GNU win32 packages | Gawk

    • 0