VBScript tips

Some tips for doing things in vbscript.

  • Convert a relative path to an absolute path
    strDirName = objFSO.GetAbsolutePathName(strDirName)
  • Type-cast a String to an Integer
    intNumber = CInt(strNumber)
  • Regular expressions in VBScript
    Set objIPAddressRegEx= new RegExp 'Create a RegExp object
    objIPAddressRegEx.Pattern = "\d+\.\d+\.\d+\.\d+"
    objIPAddressRegEx.IgnoreCase = True
    If objIPAddressRegEx.Test("10.1.1.1") Then
        WScript.Echo "String matched regular expression"
    End If

Tags: 

You might also be interested in...