Tuesday, August 16, 2016

Running VBScript from Java

Some time we may require to run vbscript from java application. It is mainly required when we try play with system. So sample code is given below how to call vbscript file from java application.

public class TestVBScript {

    public static void main(String[] args) throws IOException {
        try {
            System.out.println(new File("a.vbs").getAbsolutePath());
            Runtime.getRuntime().exec("wscript.exe " + new File("samplevbs.vbs").getAbsolutePath());

        } catch (IOException ex) {