I need to start a batch using java and after a few seconds i need to stop the running batch file.
here is my code
try {
        Process process=Runtime.getRuntime().exec("cmd /c start  D:/test.bat");
        Thread.sleep(20*1000);
        process.destroy();
    } catch (Exception e) {
        e.printStackTrace();
    }
my code failed to stop the batch file.