Is it possible to detect the type of a value stored in a Windows registry key using java?
I tried instanceof but that falls short.
I need to be able to detect if a key value is of any of these types: Binary, DWord, SZ, None, Link, QWord, Multi SZ, Expand SZ, Resource List, Full Resource Descriptor, Resource Requirements List
Thanks
Process processIn = Runtime.getRuntime().exec("reg query " + '"'+ regKey + "\" /v " + regSubKey);
StreamReader reader = new StreamReader(processIn.getInputStream());
reader.start();
reader.join();
String read = reader.getResult();
String[] parsed = reader.getResult().split("\\s+");
if (parsed.length > 1) {
read = parsed[parsed.length-2];
System.out.println("type = " + read)
}
Define regKey and regSubKey and this snippet works. There may be a way to do this cleaner but it works for what I need.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.