Share this page 

Detect WSH, Script engine and DLL versionsTag(s): WSH VBScript


Dim WSHShell, FSO, VbDll, VbDllVersion, s

Set WSHShell = WScript.CreateObject("WScript.Shell")
WScript.Echo "WSH version : " & WScript.Version

s = ""   
s = ScriptEngine & " Version "
s = s & ScriptEngineMajorVersion & "."
s = s & ScriptEngineMinorVersion & "."
s = s & ScriptEngineBuildVersion 
WScript.Echo "Script engine version : " & s

Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
If WSHShell.Environment.item("OS") = "" Then
   ' we assume a non-NT system 
   VbDll = "c:\windows\system\vbscript.dll"
Else
   VbDll = "c:\winnt\system32\vbscript.dll"
End If

VbDllVersion = FSO.GetFileVersion(VbDll)
WScript.Echo "VBScript Dll version : " & VbDllVersion & " (" & VbDll & ") "

Set WSHShell = Nothing
Set FSO = Nothing
WScript.Quit(0)