How do I add a default Run As Administrator when I open a sln file from the command prompt or Windows 7/8 Jump List menu? How do I add a default Run As Administrator when I open a sln file from the command prompt or Windows 7/8 Jump List menu? windows windows

How do I add a default Run As Administrator when I open a sln file from the command prompt or Windows 7/8 Jump List menu?


Easiest way is doing this:Right click visual studio and open file location.(If it's the shortcut, right click then click properties. On the bottom click on "Open File Location")

This should lead you to devenv.exe.

Right click this and select troubleshoot compatiblity.Select troubleshoot program and check off the box for "The program requires additional permissions" and select next.

Now if you open visual studio from where ever, it'll open it as an administrator.


It actually turns out to be one additional registry entry that needs to be set. In the shell key under the file type, change the value of (Default) to be the same name as the command in the registry under the shell folder.

For example, to set Run As Administrator to be the default, you would set the value of (Default) in HKEY_CLASSES_ROOT\VisualStudio.sln.12.0\shell to be runas.

When exported, this setting looks like this:

  [HKEY_CLASSES_ROOT\VisualStudio.sln.12.0\shell]  @="runas"

Now when you right-click the solution in Windows Explorer, or when you right-click the solution after right-clicking to bring up the Jump List on the Visual Studio 2013 pinned icon, Run As Administrator is the default command instead of Open.

So you can confidently open the solution itself from Windows Explorer or the Jump List menu and watch as Visual Studio opens as Administrator.


Updating answer for Visual Studio 2015 (under covers version "14.0"). Tested on on Windows 10 Pro v1703 Creators Update. Picture below illustrates the first registry change. Second change goes one better - no need to right-click the jump list item at all.

Windows Registry Editor Version 5.00;To add "Run As Administrator" to Visual Studio 2015 Taskbar Jump List solution right-clicks[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell\RunAs][HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell\RunAs\command]@="\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\devenv.exe\" \"%1\"";To make Jump List solutions open As Administrator by default[HKEY_CLASSES_ROOT\VisualStudio.sln.14.0\shell]@="runas"

enter image description here