Computers, Programming, Technology, Music, Literature

Run as Administrator for .sln files and other context menu essentials

leave a comment »

 

This article was originally published for www.prowareness.com and could be located at http://www.prowareness.com/blog/run-as-administrator-for-sln-files-and-other-context-menu-essentials/ 

Download the file named RunAsEssentials-RegistryKeys.zip from the SkyDrive location http://sdrv.ms/1ds9pbZ.

Many a times you would want to run certain tasks as Administrator (yeah, to run a program as elevated). As a developer, you might typically find yourself doing it for Visual Studio Solution Files (.sln). I have been using a set of hacks to enable ’Run as administrator’ for .sln files, and to open any file with Notepad, or with Notepad as administrator and a couple more of them.

Below are some screenshots of what you would get when you download the zip file named RunAsEssentials-RegistryKeys.zip and run required .reg files or the .bat file from the aforementioned SkyDrive download location.

 

image
image
image

If you’d like to do it for any other file extension, let’s say for .csproj files, then locate the .csproj file extension under the HKCR registry hive, look for the default value of the .csproj key. If it is VisualStudio.Launcher.csproj.11.0 then navigate to that key location. Crack open the command subkey key under Open . Copy the default value "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe" "%1".

Create a new key named runas and a subkey under it named Command . And associate the Command key’s default value as "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe" "%1".

image

To add a Shield icon to the context menu option add a value named HasLUAShield to the runas key. LUA expands as Limited User Account.

image

Notes:

Adding keys to the HKCR makes changes to all the users in the computer. If you’d like to do it only for a particular user, then find and edit the file extension handlers under HKCR\Software\Classes.

If you get Access Denied or Merge failed or Cannot Import Error accessing the registry error messages, then open a command prompt as administrator and try running the .bat or .reg files.

image

Disclaimer:

Although it is said/recommended to take a back up of your registry before doing any changes, these registry files possess no harm per se. All these .reg files are provided in good faith and with goodwill, so use it at will.

Advertisements

Written by gmaran23

August 30, 2013 at 12:49 pm

Posted in Windows

Tagged with , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: