Runtime.getRuntime().exec("cscript E:\w2_0_2\bin\stop-g.vbs");
使用上面一句代码,调试程序也不报错,但没有起到双击运行stop-g.vbs的效果,什么原因?
请指点,多谢。
.vbs中的代码如下
set ws=WScript.CreateObject("WScript.Shell")
ws.Run "E:\w2_0_2\bin\stop-g.bat",0
Runtime.getRuntime().exec("cscript E:\w2_0_2\bin\stop-g.vbs");
使用上面一句代码,调试程序也不报错,但没有起到双击运行stop-g.vbs的效果,什么原因?
请指点,多谢。
.vbs中的代码如下
set ws=WScript.CreateObject("WScript.Shell")
ws.Run "E:\w2_0_2\bin\stop-g.bat",0
收起
不对~~
Java调用VBS应该这样:
[code="java"]String[] cpCmd = new String[]{"wscript", "VBS脚本位置"};
process = Runtime.getRuntime().exec(cpCmd);
// wait for the process end
int val = process.waitFor();//val 是返回值[/code]
报告相同问题?