We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › pass instructions to the command line
Page Index Toggle Pages: 1
pass instructions to the command line (Read 409 times)
pass instructions to the command line
Oct 15th, 2009, 3:11am
 
Hi all,

how can i do something like, passing instructions to the command line of windows. E.g. would i need to get the information of 'ipconfig -all' or 'arp /a'. Is this possible?

cheers
Re: pass instructions to the command line
Reply #1 - Oct 15th, 2009, 3:22am
 
found it:

import java.io.*;

try {
 String line;
 
 OutputStream stdin = null;
 
 Process p = Runtime.getRuntime().exec("ipconfig /all");

   
 BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
 
 while ((line = input.readLine()) != null) {
   println(line);
 }
   input.close();
} catch (Exception err) {
 err.printStackTrace();
}

exit();
Page Index Toggle Pages: 1