java调用批处理命令.bat

public static void Uninstall(String targetPath) {
		String strcmd1 = "cmd /c start " + targetPath + "/ece-sta/stop.bat";
		String strcmd2 = "cmd /c start " + targetPath + "/ece-sta/Uninstall.bat";
		try {
			Process pro1 = Runtime.getRuntime().exec(strcmd1);
			pro1.waitFor();
			Thread.sleep(3000);
			Runtime.getRuntime().exec(strcmd2);

			String delPath = targetPath + "/ece-sta";
			deleteFile(delPath);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

你可能感兴趣的:(Java)