# Command to run an application with Administrator privileges but NOT AS Administrator (prompt with UAC)

I want to start notepad with elevated privileges to edit C:\Windows\System32\drivers\etc\host. Notmally I would type notepad in the search box, and with the program highlighted hot ctrl-shift-enter, click Yes on the UAC prompt and then open the file. I do this often, so I want a batch file to do it.

I tried the following command:

runas /user:Administrator /savecred notepad.exe path\to\file


But this is not exaclty what I want, as it prompts for the password of the Administrator account. I really want a command to start a program with elevated privileges for the current user account.

I run Windows 7 RC.

Thanks!

-

As notepad is a Windows tool, you may not set "Run always as administrator", but there's a trick. Create a symbolic link and open the properties dialog. Under the link properties, select Advanced (bottom right button) and select "Run link as administrator". This should elevate the process.

Edit: I hope this is still the same in Win7 (I tested on Vista)

-
Perhaps you could include the directions to create a symbolic link? I don't think it's something most users would ever find. :) –  Joshua Oct 12 '09 at 13:57
I created the symbolic link using mklink. The advanced button is disabled. I turned of UAC instead :p –  michielvoo Oct 14 '09 at 22:12
The Advanced button on the Shortcut tab is indeed disabled on my Win7 installation (I'm running 7 Pro x64). However, on the Compatibility tab, there is an option to "Run this program as an administrator" ... so it looks as though things just got moved around between Vista and 7. –  David Dec 9 '11 at 16:49