Start a program that is in Program Files folder

2019-07-23 12:27发布

问题:

I want to start an exe with java.
This exe is in the Program Files (x86) folder and when I try :

Runtime.getRuntime().exec("C:\\Program Files (x86)\\CodFiscExtractor\\MySQLServer\\MySqlStart.exe");

the console displays me this error :

CreateProcess error=740, The requested operation requires elevation 

What I should do?

EDIT : this is not a duplicate of this, because i'm asking java

回答1:

I resolved, simply I writed like this :

Runtime.getRuntime().exec("cmd /c \"C:\\Program Files (x86)\\CodFiscExtractor\\MySQLServer\\MySqlStart.exe\"");

Now I don't have error, but I am insterested to don't show UAC window, because MySqlStart.exe starts with admin privileges.



标签: java runtime exe