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("") Then
        WScript.Echo "String matched regular expression"
    End If


You might also be interested in...