Dejo este método que tenía por mi baúl. No sé quien es el autor.

Código: Seleccionar todo

public static final String readRegistry(String location, String key)
  {
    try
    {
      Process process = Runtime.getRuntime().exec("reg query \"" + location + "\" /v " + key);
      Main.StreamReader reader = new Main.StreamReader(process.getInputStream());
      reader.start();
      process.waitFor();
      reader.join();
      String[] parsed = reader.getResult().split("\\s+");
      if (parsed.length > 1)
        return parsed[(parsed.length - 1)];
    }
    catch (Exception localException) {
    }
    return null;
  }
Responder

Volver a “Fuentes”