Dim WshShell, FSO Dim gTmpPath Set WshShell = CreateObject("WScript.Shell") Set FSO = CreateObject("Scripting.FileSystemObject") ' ************************************************************************* ' This function provides a temp path. To be used by the ExecuteCmd function. ' ************************************************************************* Function GetTempPath GetTempPath = WshShell.ExpandEnvironmentStrings("%TEMP%") & "\" End Function ' ************************************************************************* ' Executes a command and returns the text output ' ************************************************************************* Function doCmd(cmd) Dim exeOutput Dim sCmd Dim outFile, outFilename outFilename = gTmpPath & FSO.GetTempName sCmd = "%COMSPEC% /D /c " & cmd & " > " & outFilename 'Wscript.Echo sCmd exeOutput = WshShell.Run(sCmd, 0, True) 'Wscript.Echo exeOutput Set outFile = FSO.OpenTextFile(outFilename) doCmd = outFile.ReadAll outFile.Close FSO.DeleteFile(outFilename) End Function Dim cmdOut Dim path path = Wscript.ScriptFullName path = Left(path, inStrRev(path, "\")) 'Wscript.Echo path gTmpPath = GetTempPath() cmdOut = doCmd( """" & path & "PreReqChecker\omchecks.exe"" 2008_CORE 3 0" ) 'Wscript.Echo cmdOut 'get os name Dim regEx, Match, Matches ' Create variable. Dim lineRex, lineMatches Dim astr, found Set regEx = New RegExp ' Create a regular expression. Set lineRex = New RegExp regEx.Pattern = ".*\n" ' Set pattern. regEx.IgnoreCase = True ' Set case insensitivity. regEx.Global = True ' Set global applicability. lineRex.Pattern = "Status=\s*(\d+)" Set Matches = regEx.Execute(cmdOut) ' Execute search. For Each Match in Matches ' Iterate Matches collection. Set lineMatches = lineRex.Execute(Match.value) if lineMatches.count > 0 then 'Wscript.Echo lineMatches(0).SubMatches(0) astr = lineMatches(0).SubMatches(0) found = Cint(astr) exit For end if Next Dim sCmd, exeOutput Dim jCmd jCmd = """" & path & "ia\jre\bin\java"" -cp """ & path & "setup_java"" setup """ & path & "\""" ' note that the path argument has a trailing '\' which has to be protected to pass correctly if ( found = 3 ) then ' 3 is the core return value sCmd = "%COMSPEC% /C """ & jCmd & """ > " & gTmpPath & "MD3000i_setup.txt 2>&1" else sCmd = "%COMSPEC% /C """ & path & "setup.exe""" end if 'Wscript.Echo sCmd exeOutput = WshShell.Run(sCmd, 0, True)