您的位置:首页 > 编程语言 > Java开发

java执行系统cmd命令(未测试)

2016-07-22 10:41 405 查看
class ExecCmd {
public static void main(String args[]) {
Runtime run = Runtime.getRuntime();
Process process = null;
try {
process = run.exec("notepad"); // 执行cmd命令
process.waitFor();
} catch (Exception e) {
System.out.println("Error executing notepad.");
}
System.out.println("Notepad returned " + process.exitValue());
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: