• Post Reply Bookmark Topic Watch Topic
  • New Topic

executing a batch file in java  RSS feed

 
joseph cooper
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a run.bat file that I would like to execute within java. I can not seem to get run.bat to execute. I have placed a prompt $t for time and a pause statement. Just for the sake of it I got notepad.exe to open.

- code snipet -

//java.lang.Runtime.getRuntime().exec ("C:\\WINNT\\NOTEPAD.EXE"); //okay
//java.lang.Runtime.getRuntime().exec
( "C:\\DEV\\RF\\runtime\\NOTEPAD.EXE"); //okay
//java.lang.Runtime.getRuntime().exec("C:\\DEV\\RF\\runtime\\run.bat"); //no
java.lang.Runtime.getRuntime().exec("cmd C:\\DEV\\RF\\runtime\\run.bat");

- code snipet from run.bat -

prompt $t
pause
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!