Reputation: 247
I want to execute the following mysql query, using java code:
mysqldump -uroot -ppassword temp1>C:\abc.sql
After a lot of search I found out that this needs cmd to run as admin I don't know how to run as admin using java code. I tried this but it doesn't work
runtimeProcess = Runtime.getRuntime().exec(new String[] { "runas /profile /user:Administrator \"cmd.exe", executeCmd });
Does any one has any idea regarding this. Thanks in advance.
Upvotes: 3
Views: 7613
Reputation: 5944
You can use runas /savecred
to execute, but I suggest you use JNI instead:
You can find examples here:
Upvotes: 1