Monday, May 02, 2011

Executing Java from VBScript

This post is simple, it's just some Visual Basic Script for executing a jar and keeping the text output in a variable:

  1. Set objShell = WScript.CreateObject("WScript.Shell")  
  2. Set objExecObject = objShell.Exec("java -classpath JavaCode.jar JavaClassName")  
  3.   
  4. Do Until objExecObject.StdOut.AtEndOfStream  
  5.  Results = Results + " " + objExecObject.StdOut.ReadLine()   
  6. Loop  

No comments: