Hello,
Say you have a program called "whatever.exe". Basically, what this program does is to run batch commands, "dir" and "cd".
if you run this "whatever.exe", the output will be something like...
------
dir...
blahblah. list of directories..
cd blahblah..
------
you want to run this "whatever.exe" from java application..
So like..
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("whatever.exe");
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = null;
while( (line = input.readLine() ) != null) {
System.out.println(line);
}
cool...done..you are going to see the output result for the whatever.exe at your console...
However, the thing I want is that..somehow..I want to intercept the cd command and change the parameter on the fly...
For example, say, this whatever.exe runs "cd C:\ABCD" internally, but somehow I want to change this cd command like "cd C:\EFGH" to run by my Java application..
Well..obviously, you don't have a source code for "whatever.exe".
I was thinking if we somehow..somehow...could manipulate some stream...this could be done....but I really don't think though..
Anyway, any idea would be appreciated.
Thanks,