I have a batch file which will 3 inputs one by one.
Its like 'changepassword.bat' with below inputs:
Old Pwd:
New Pwd:
Confirm Pwd:
User need to enter each input and press enter to enter second input.
Now, I am planning to simulate the same in
java program.
For this I am using Runtime.exec();
I am writting inputs to outputStream which is the process.getOutputStream() like below:
out.write(bytes1);
out.write(System.getProperty("line.separator").getBytes());
out.write(bytes2);
out.write(System.getProperty("line.separator").getBytes());
out.write(bytes2);
out.flush();
out.close();
the process is being started and keep on waiting for the input.
I am assuming that the process is taking all my data written to stream as single input like ,
(byte1\nbyte2\nbyte3)
and waiting to either <enter> event or for other inputs.
Please help me solving this issue. or suggest any other approach.