Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Detect Version Java Java.exe
#DefineFunction CaptureDosOutput(DosCommand) DataArray=ArrDimension(3) ;Allocate return array ArrInitialize(DataArray,"") ;initialize to all null strings oShell = ObjectCreate("WScript.Shell") ;open shell object oScriptExec = oShell.Exec(DosCommand) ;run the command ;Open output objects oStdOut = oScriptExec.StdOut oStdErr = oScriptExec.StdErr While (oScriptExec.Status==0) ;wait for completion ;Caputure StdOut data oStdOut = oScriptExec.StdOut While ! oStdOut.AtEndOfStream strLine = oStdOut.ReadLine DataArray[1] = StrCat(DataArray[1],strLine,@CRLF) EndWhile ;Capture StdErr data oStdErr = oScriptExec.StdErr While ! oStdErr.AtEndOfStream strLine = oStdErr.ReadLine DataArray[2] = StrCat(DataArray[2],strLine,@CRLF) EndWhile TimeDelay(0.1) EndWhile ;Get remainder of data, if any ;Caputure StdOut data oStdOut = oScriptExec.StdOut While ! oStdOut.AtEndOfStream strLine = oStdOut.ReadLine DataArray[1] = StrCat(DataArray[1],strLine,@CRLF) EndWhile ;Capture StdErr data oStdErr = oScriptExec.StdErr While ! oStdErr.AtEndOfStream strLine = oStdErr.ReadLine DataArray[2] = StrCat(DataArray[2],strLine,@CRLF) EndWhile DataArray[0]=oScriptExec.ExitCode ;save errorlevel/exit code ;Close handles that were opened oStdOut = 0 oStdErr = 0 oScriptExec = 0 oShell = 0 ;Return the array Return(DataArray) #EndFunction CaptureArray=CaptureDosOutput("java.exe -version") ; for built-in dos commands Pause('JavaVersion',CaptureArray[2])
Article ID: W17923
Filename: Detect Version of Java.txt
File Created: 2010:03:22:11:33:52
Last Updated: 2010:03:22:11:33:52