C
Chris
All,
I am looking to interact with the command prompt on my Windows XP
(sp2) system. I have reread books and followed message board threads
and have found success in executing cmd.exe and loading up a batch
file.
However, now that the batch has loaded and I can see it, I am trying
to interact with it through my java project. (By intereact I mean pass
arguments and text to it). Here's where I get stuck... Does anyone
know how I can accomplish this?
Thank you very much for your time.
*****************************************************************
import java.io.*;
public class ArConsole {
public static void main(String args[])
{
try
{
String intel = "C://arconsole.bat";
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(intel);
BufferedReader input = new BufferedReader(new
InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null)
{
System.out.println(line);
}
int exitVal = pr.waitFor();
System.out.println("Exited with error code
"+exitVal);
}
catch(Exception e)
{
System.out.println(e.toString());
e.printStackTrace();
}
}
}
I am looking to interact with the command prompt on my Windows XP
(sp2) system. I have reread books and followed message board threads
and have found success in executing cmd.exe and loading up a batch
file.
However, now that the batch has loaded and I can see it, I am trying
to interact with it through my java project. (By intereact I mean pass
arguments and text to it). Here's where I get stuck... Does anyone
know how I can accomplish this?
Thank you very much for your time.
*****************************************************************
import java.io.*;
public class ArConsole {
public static void main(String args[])
{
try
{
String intel = "C://arconsole.bat";
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(intel);
BufferedReader input = new BufferedReader(new
InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null)
{
System.out.println(line);
}
int exitVal = pr.waitFor();
System.out.println("Exited with error code
"+exitVal);
}
catch(Exception e)
{
System.out.println(e.toString());
e.printStackTrace();
}
}
}