<September 2010>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
Start applications elevated from the command prompt

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.

No Comments

Title
Author
Comment
Anti Bot Image   
  
Rss
  
Elevate Source (3.6 KB)
Sourcecode for elevate command line tool
Elevate.exe (20.7 KB)
Elevate commandline tool

Rss
Tag Cloud