天天看点

JAVA调用CMD命令

String commandText = "cmd /c start D:/index.html";   
  
/ String commandText = "cmd /c start osk";//这里可以是命令   
try {   
 Runtime.getRuntime().exec(commandText);   
} catch (IOException e) {   
 // TODO Auto-generated catch block   
 e.printStackTrace();   
}