My question is quite simple, I would like to run .exe in my own directory, but with rights / privileges. I know this question was raised earlier, but I did not find the right way to fix my problem.
In fact, I first tried this:
String workingDir = "C:\\TEST\\";
String cmd = workingDir + "game.exe";
Runtime.getRuntime().exec(cmd,null,new File(workingDir));
I got the following error:
CreateProcess error=740, The requested operation requires elevation
Then I tried this:
ProcessBuilder builder = new ProcessBuilder(
new String[] {"cmd.exe", "/C","C:\\TEST\\game.exe"});
Process newProcess = builder.start();
And it starts, but not in its own directory. How can i fix this?
source
share