PDA

Tam Sürümünü Görmek İçin : JAVA da dos komutları?


meczup
29/04/2003, 16:40
JAVA da DOS komutlarını nasıl kullanabilirim.


acemi
29/04/2003, 21:21
Runtime.exec()

darky_dark
30/04/2003, 08:01
asagida da dos uzerinden istenen 1 hostu ping leyen 1 kod var..

..................................

String hostAddress, pingCount, timeoutValue;
String tempStr = "";

hostAddress = destHost.hostAddress;
pingCount = "-n " + destHost.pingCount;
timeoutValue = " -w " + destHost.timeoutValue;

String pingCommand = "ping " + pingCount + timeoutValue + " " + hostAddress;


Process pingProcess = Runtime.getRuntime().exec(pingCommand);
InputStream inStream = pingProcess.getInputStream();
BufferedReader bReader = new BufferedReader(new InputStreamReader(inStream));
String resultLine = "";
String errStr = "seems OK";
int countTimeOut = 0;

while ((resultLine = bReader.readLine()) != null)
{
System.out.println(resultLine);
}
pingProcess.waitFor();
// pingProcess.destroy();
bReader.close();

...................................


sevgi, saygi..

_DD_