java执行需要参数的bat文件

bat文件:
@echo off
cd c:\
echo set sh=WScript.CreateObject("WScript.Shell") >telnet_tmp.vbs
echo WScript.Sleep 300 >>telnet_tmp.vbs
echo sh.SendKeys "open %1{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 3000 >>telnet_tmp.vbs
echo sh.SendKeys "%2{ENTER}" >>telnet_tmp.vbs
echo WScript.Sleep 3000 >>telnet_tmp.vbs
echo sh.SendKeys "%3{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 3000 >>telnet_tmp.vbs
echo sh.SendKeys "reboot{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 3000 >>telnet_tmp.vbs
echo sh.SendKeys "exit{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 5000 >>telnet_tmp.vbs
echo sh.SendKeys "{ENTER}">>telnet_tmp.vbs
echo WScript.Sleep 3000 >>telnet_tmp.vbs
echo sh.SendKeys "q{ENTER}">>telnet_tmp.vbs
start telnet

cscript //nologo telnet_tmp.vbs
del telnet_tmp.vbs

action:
String path=ServletActionContext.getServletContext().getRealPath("//WEB-INF//classes//reboot.bat");
String command=path+" "+this.getIp()+" "+this.remotName+" "+this.remotPassword;
try {
Process ps = Runtime.getRuntime().exec(command);
} catch (IOException e) {
e.printStackTrace();
}

你可能感兴趣的:(bat)