Hey All:
I'm trying to get a value of a registry key by using the 'reg query' command invoked through runtime. i.e.)
public static final String OFF_DOMAIN_BRANCHMAX_QUERY = "reg query HKEY_CURRENT_USER\\Software /v BranchMax";
...
Process process = Runtime.getRuntime().exec(query);
StreamReader reader = new StreamReader(process.getInputStream());
...
Then I simply get the value returned to my StreamReader. This stuff works!!!! I've tested it.
BUT, I need to run this command as a service to get certain key values that not all users can see by running 'reg query'.
The DOS command is simple enough:
C:\WINDOWS\system32\runas.exe /user:services /savecred reg query HKEY_CURRENT_USER\Software /v BranchMax
However, Runtime is NOT DOS. So how do I launch this command from Java and get the same result?
Thanks.