Reputation: 621
I have a dos command which starts an application. I want to start the application as an administrator. How can i do so? Below is the code which i tried.
String arg[]={"C:\\app1.exe", "C:\\app2.exe", "c:\\app3.exe"};
String pwd[]={"123","-x","-sf"};
String outputfile="c:\\output.xml"
String command=arg[0]+pwd[0]+arg[1]+pwd[1]+arg[2]+pwd[3]+output;
Process pr=rt.exec(command);
I tried the same command from command prompt and its working fine. But when i try to run the same from java code, it keeps on running without producing any output.
Upvotes: 2
Views: 3105
Reputation: 56
see runas -command:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true
Upvotes: 2