sahana
sahana

Reputation: 621

running a dos command via java as administrator

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

Answers (1)

Related Questions