public static String getCurrentUserPersonalFolderPath() { try { Process process = Runtime.getRuntime().exec(PERSONAL_FOLDER_CMD); StreamReader reader = new StreamReader(process.getInputStream());
reader.start(); process.waitFor(); reader.join();
String result = reader.getResult(); int p = result.indexOf(REGSTR_TOKEN);
public static String getCPUSpeed() { try { Process process = Runtime.getRuntime().exec(CPU_SPEED_CMD); StreamReader reader = new StreamReader(process.getInputStream());
reader.start(); process.waitFor(); reader.join();
String result = reader.getResult(); int p = result.indexOf(REGDWORD_TOKEN);
if (p == -1) return null;
// CPU speed in Mhz (minus 1) in HEX notation, convert it to DEC String temp = result.substring(p + REGDWORD_TOKEN.length()).trim(); return Integer.toString ((Integer.parseInt(temp.substring("0x".length()), 16) + 1)); } catch (Exception e) { return null; } }
public static String getCPUName() { try { Process process = Runtime.getRuntime().exec(CPU_NAME_CMD); StreamReader reader = new StreamReader(process.getInputStream());
reader.start(); process.waitFor(); reader.join();
String result = reader.getResult(); int p = result.indexOf(REGSTR_TOKEN);
/** * @author Oleg Ryaboy, based on work by Miguel Enriquez */ public class WindowsReqistry {
/** * * @param location path in the registry * @param key registry key * @return registry value or null if not found */ public static final String readRegistry(String location, String key){ try { // Run reg query, then read output with StreamReader (internal class) Process process = Runtime.getRuntime().exec("reg query " + '"'+ location + "\" /v " + key);