/RunAsAdmin

Simple win32 application that will start most executables with administrator rights (with UAC prompt)

Primary LanguageC++MIT LicenseMIT

RunAsAdmin

Simple win32 application that will start most executables with administrator rights (UAC prompt). This application will not bypass safeguards in-place by the OS.

Configuration File

The configuration file has to be named RunAsAdmin.cfg! If a file named this isn't placed directly next to the executable, then the application won't be able to load any configuration and will fail. When there is no file present, RunAsAdmin will create a default configuration file and alert you to the creation. Be sure to edit this though!

Configuration is extremely easy. It's just a two-line text file (not .txt, .cfg!). The first line is the executable you want to launch, and the second line is all the default command line arguments you may need.

One thing to note is that the command line arguments in the configuration file are the default, meaning if you pass command line arguments to the RunAsAdmin.exe, these will be used instead. This was added via a request, so the launcher would support shell extensions (i.e. dynamic file paths).

Example Configuration

PatchIt.exe
--test

This will launch PatchIt.exe on start, and also provide the executable with the --test argument if no dynamic arguments are passed.

The example below, however, will pass just --help. The default parameters are unused unless no dynamic arguments are passed to this application.

RunAsAdmin.exe --help

How It Works

The application uses a ShellExecute call with the runas verb. Internally, this triggers a UAC prompt which allows your application to gain administrator rights from the UAC without the need of special manifest files that aren't available for all executables.