Set UAC = CreateObject("Shell.Application")
UAC.ShellExecute "C:\Users\Biebs\Desktop\New folder\Loader.bat", "ELEV", "", "runas", 1
I'm trying to execute a Java file as an administrator, this one requires a terminal so it will be a little harder then simply running the Jar in an administrator's cmd.
I have a Java loader that executes the class file to the java program. I tried to run the loader as an Administrator, it gives me a 'cannot find or load main class' error. So I found a VBS script that would execute the batch as an administrator, however this still didn't work. However just to clarify, when I run the loader as a non administrator it works perfectly. How can I execute a java program, that requires a terminal, so I can have administrator rights.
Here's a runas program. Run without parameters for help.
Java: run as administrator helped to solve my problem. Just make sure to add the Elevate.exe into the folder of your source (where the .class and .java files are), afterwards all administrator commands can be executed by using this code...
Thanks to user mathd for posting that...
The elevate program can be found at http://jpassing.com/2007/12/08/launch-elevated-processes-from-the-command-line/ . Thanks to all who helped :)