ava代码 public static void main(String[] args) { String path = "D:\public.bat"; Runtime run = Runtime.getRuntime(); try { // run.exec("cmd /k shutdown -s -t 3600"); Process process = run.exec("cmd.exe /k start " + path); InputStream in = process.getInputStream(); while (in.read() != -1) { System.out.println(in.read()); } in.close(); process.waitFor(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { String path = "D:\public.bat"; Runtime run = Runtime.getRuntime(); try { // run.exec("cmd /k shutdown -s -t 3600"); Process process = run.exec("cmd.exe /k start " + path); InputStream in = process.getInputStream(); while (in.read() != -1) { System.out.println(in.read()); } in.close(); process.waitFor(); } catch (Exception e) { e.printStackTrace(); } }
评论列表
文章目录