I have opened a commnad prompt using java program and another command prompt manually. Now my requirement is that i need to close the command prompt that i have opened by ja
It's simple -
Step 1 - Create a batch file (say closeCMD.bat)
Step 1
Step 2 - write exit in closeCMD.bat
Step 2
Step 3 - call above batch file in your java code as below -
Step 3
Runtime.getRuntime().exec("cmd /c start closeCMD.bat");
That's it !! Cheers!!