Hi Friends,
I want to create a batch file through
java program in one method and execute it in another method.
createBat()
{
File file=new File("C:\\samplenote.bat");
fos=new FileOutputStream(file);
dos=new DataOutputStream(fos);
dos.writeBytes("ECHO happy >> myBatch.txt");
dos.writeBytes("START note.txt");
}
executeBat()
{
String cmd="cmd /c start c:samplenote.bat";
Runtime r=Runtime.getRuntime();
Process pr=r.exec(cmd);
}
when i want to create a batch file with more than one command . all commands in the batch file is written in the same line.
like this
samplenote.bat
*************
ECHO happy >> myBatch.txtSTART note.txt
but i want like the below one
samplenote.bat
*************
ECHO happy >> myBatch.txt
START note.txt
what should i for that.
is there any command to write commands in batch file in consecutive lines