ProcessBuilder - make call to systeminfo | find xxx
Hi,
the question is if I can make processbuilder execute
systeminfo | find"Total Physical Memory"
instead of parsing the output given from
ProcessBuilder processBuilder =new ProcessBuilder("systeminfo");
The application I am working on is for personal useonly so I don't have to think about multi-lingual stuff or so, even if that would be preferable. The plan is just to get it to work, without JNI or bundled platform-specific executables.
- Adam
edit:
I thought this would work but it's not.
ProcessBuilder processBuilder =new ProcessBuilder("systeminfo | find \"Total Physical Memory:\"");
try{
Process process = processBuilder.start();
InputStream is = process.getInputStream();
InputStreamReader isr =new InputStreamReader(is);
BufferedReader br =new BufferedReader(isr);
String line;
while ((line = br.readLine()) !=null){
System.out.println(line);
}
}
catch(Exception e){
e.printStackTrace();
}

