天天看點

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();

}