How to use Wscript Exec to run a Java file

后端 未结 1 1833
囚心锁ツ
囚心锁ツ 2021-01-23 17:18

As the description of Wscript:String value indicating the command line used to run the script: The command line should appear exactly as it would if you typed it at the comm

相关标签:
1条回答
  • 2021-01-23 17:44

    Take a look at the WSHSell object's run method. The following code works for me:

    var shell = new ActiveXObject("WScript.Shell");
    shell.run("cmd /c java -jar MyApplication.jar");
    // should work without JARs as well, take care for the working path
    

    The run method has an option to wait for the java program to return.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题