.Bat file to Open cmd window -
OK, so I have to write a .bat file to open the DOS window, so that I can run my CS project. Yes, I know that I can just open the CMD window, but the professor wants to write a .bat file to open the CMD window. How to write a .bat file to open any CMD window? The way I am coding in Java, if it is a difference
You can do this < Create code> runtime class .bat file and put it in Project Home directory.
In my example, there is START cmd.exe in testbat.bat.
This will be a completely "Combination of Java + Bat + CMD"
Try it: test and execute.
// Import your package here java.io. *; Public Category TestExec {Public Static Zero Main (String [] Args) {Try {Process P = Runtime.GetReight (). Exec ("testbat.bat"); BufferedReader = new BufferedReader (new InputStreamReader (p.getInputStream ()); String line = null; While ((line = r. rummy ()) = null) {System.out.println (line); }} Hold (IOException e) {e.printStackTrace (); }}}
Comments
Post a Comment