To capture the system information for Windows OS
FileData data = null;
String outputFileName = destFolder + File.separator + Defaults.SYSTEM_INFO_FILE;
final String ALL_CMDS =
"(echo HOSTNAME & "+HOST_NAME_CMD+" & " +
"echo OS INFO & "+ OS_INFO_CMD +" & " +
"echo MEMORY INFO & " + MEMORY_INFO_CMD + " & " +
"echo IP ADDRESS & " + IP_ADDRESS_INFO_CMD + ") >> " + outputFileName ;
String[] cmd = {"cmd.exe", "/C", ALL_CMDS};
ProcessExecutor executor = new ProcessExecutor(cmd, 0);
try{
executor.execute();
File outputFile = new File(outputFileName);
data = new FileData(outputFile.getName(),DataType.SYSTEM_INFO);
}
catch(ProcessExecutorException pee){
logger.log(Level.WARNING, "Exception while capturing system info" +
" : " + pee.getMessage());
}
return data;