public class ReadRegTest {
public static void main(String[] args) {
try {
Process ps = null;
ps = Runtime.getRuntime().exec("reg query HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\scas111");
ps.getOutputStream().close();
InputStreamReader isr = new InputStreamReader(ps.getInputStream());
String line;
String[] list;
BufferedReader buffer = new BufferedReader(isr);
while((line = buffer.readLine()) != null){
if(line.contains(":")){
int indexOf = line.indexOf(":");
line = line.substring(indexOf-1, line.length());
System.out.println(line);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
读取注册表中某个软件安装路径的字段值
最新推荐文章于 2022-03-24 12:56:03 发布