|
I wrote a very simple command line app named elevate to start applications with the elevation prompt in Win7/Vista. The function that starts it up is “ShellExecute” and the 2nd parameter is the one that tells windows to start it elevated. // Launch the Application elevated HINSTANCE hResult = ShellExecute(NULL, _T("runas"), argv[1], cmdLine, NULL, SW_SHOWNORMAL);
You can rename it to 'el.exe' and put it in a folder referenced by the PATH environment variable so that it can be launched from everywhere.
It forwards supplied parameters to the launched appliction.
Usage: 'elevate cmd' or 'elevate notepad c:\test.txt'.
Sourcecode and the compiled app can be downloaded below.
|