Top Nav

How to Run Any File Type as an Administrator in Windows 7 and Vista

Windows 7 - Setup run as administrator for any file typeIf you’ve ever tried to mess with files in the Windows or Program Files folders of Windows 7, you’ve probably noticed that Windows likes to throw up permissions errors.  This is mostly because these areas are considered protected operating system directories, and editing them can cause problems.  But, if you know what you are doing -these permission blocks are just a huge annoyance. 

 

One of the ways around this problem is to set up a “Run as administrator” option to the context menu for troublesome file types.  Windows doesn’t have an easy intuitive way to do this, but I’ll guide you below on the process and make it as simple as possible. 

Let’s get started!

Step 1 – Open regedit

Click the Windows Start Menu Orb and then Type regedit into the search box.  Now Press Enter or just Click the program link.

open regedit in windows 7

Step 2

In registry editor, browse to the file extension that you want to open as an administrator.  All file extensions are stored in the HKEY_CLASSES_ROOT tree.  For example, I’m going to add “Run as administrator” to all my .zip files.  To do this I’ll browse to the following registry key:

HKEY_CLASSES_ROOT\.zip

Once here, take a look at the (Default) entry’s data value.  For .zip mine reads CompressedFolder.  This means that the actual key I need to edit will be named CompressedFolder, so let’s go find it.browse to hkey classes root location

Step 3

There are two ways to find a key in the registry.  One is obvious, just browse through your registry until you find it… The other way is a bit faster, just hit CTRL+F on your keyboard and type in the name of the key you are looking for.  Since we know that the key I’m looking for is called compressedfolder, I can search for exactly that.  This will let us find the key in a matter of seconds.

search for the compressedfolder file type key

Now that we’ve located the key, we need to open to the open path and make a copy of it.  The exact path that we are going to copy is:

HKEY_CLASSES_ROOT\CompressedFolder\shell\Open\Command

command file extension registry key

Step 4

Now, to make a copy we need to use the Export function.  Right-Click the Command key and Select Export from the context menu.

export command

Windows will ask you to specify a file name and a location to save the copy.  The name of the file is irrelevant, as the only thing that matters is the data within the file itself.  Save it somewhere easy to find –we’ll be deleting it after we are done with it.

save registry key

Step 5

Now that you have the file saved, Right-Click the registry file and Select Open with > Notepad.

notepad delete after use

Now in notepad, we just need to change one word in the text of the file.  We are going to change replace Open and in it’s place Type runas.

So …shell\Open\Command]  will become …shell
unas\Command.

Once that is done, Save the file.

open turns into runas and save text file

Step 6

Now we just need to add our edited registry information to the Windows registry.  To do this, Double-Click the .reg file we just edited, or Right-Click the file and Select Merge

merge new registry key

A small confirmation box will appear, Click Yes and then OK.

registry key confirmation

What this does is in effect create a new key called runas that is exactly the same as the original Open key.

runas command 

Done!

Now Run as administrator should show up in the context menu of the extension you just added it to.  In this tutorial we covered the process with .zip file types, but you can repeat this process for any file type you like.

open run as administrator

Don’t forget now that we are done with the edited registry file that we saved earlier, you can delete it!  Cleanliness is next to grooviness!

delete old registry key file

, ,

5 Responses to How to Run Any File Type as an Administrator in Windows 7 and Vista

  1. Lee November 3, 2011 at 3:01 am #

    Thanks. This really help me!

  2. Ampit March 28, 2012 at 9:58 am #

    What a help mate …
    brilliant post
    saved my time…
    thanks

  3. Ethan September 10, 2012 at 6:44 pm #

    What do I do If It gives me ‘Cannot import D:DocumentsDesktopdelete-after-use.reg: Not all data was successfully written to the registry. Some keys are open by the system or other processes.’ ?

    • Mack September 10, 2012 at 8:27 pm #

      restart the pc

  4. Joel Thibeault September 20, 2012 at 8:13 am #

    This worked great for me. The only thing I would like to find out is if it is possible to make 2 programs use the run as command for the context menu from a directory. I am using this by executing the program parameters under command in the default string value. How can I make this work for 2 programs. Joel

Leave a Reply

 

×

Get Early Black Friday Deals Now - Amazon.com Check Deals