Get System Information under JAVA
How to get the Computer brand and model from JAVA under Windows.
private static String execCmd(String cmd) throws java.io.IOException {
java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
}
public getSystemInfo() {
try {
String result=execCmd("wmic.exe computersystem get model,name,manufacturer,systemtype");
return result;
} catch (IOException ex) {
}
return "Not available";
}
Comments
Post a Comment