I want to execute a command from a Java application using
Runtime.getRuntime.exec(command);
but the team needs administrator privileges. If i use
runas /user:Administrator "cmdName parameters"
nothing happens because I need to specify user and pw as a parameter for the command. But I need to run the command for cmd, so the new cmd.exe starts as administrator and asks if I want to run cmd.exe as an administrator. After negotiation, the command should be run in admin-cmd. So like this:
String command = "popupNewCmdAsAdminAndRun "batWhichNeedsAdmin.bat" " Runtime.getRuntime.exec(command);
Is there any idea? Thanks in advance!
java cmd batch-file exec
Muten roshi
source share