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("cmd /c reg query " + 
                    '"'+ location + "\" /v " + '"' + key + '"');

            StreamReader reader = new StreamReader(process.getInputStream());
            reader.start();
            process.waitFor();
            reader.join();
            String output = reader.getResult();

            // Parse out the value
            return output.trim().replaceFirst("^(.|\\r|\\n)*\\s{2,}", "");
        }
        catch (Exception e) {
            return null;
        }

    }
@param location path in the registry
@param key registry key
@return registry value or null if not found
installer/src/com/ray3k/skincomposer/installer/WindowsRegistry.java