Subscribe to How-To Geek

Add "Run as Administrator" to Any File Type in Windows Vista

Have you ever tried to unzip a file to the Program Files directory in Vista? You'll get all sorts of permission denied errors, and generally be unsuccessful. So how do we open up the zipfile as an administrator? For that matter, how do you open any file as administrator?

There's a simple registry tweak that will let us specify the action to run as administrator for a file type. Unfortunately you'll have to make the tweak manually, but we'll walk you through it.

Note: The method explained here is courtesy of jd2066, one of the helpful geeks over on our forum.

Manual Registry Tweak

Open regedit through the start menu search or run box and then browse down to the following key, substituting ".zip" for the file extension that you are looking for. (Note that the find dialog helps here)

HKEY_CLASSES_ROOT\.zip

image

Now you want to take note of the Data value for the "(Default)" item. This tells you which application is registered to handle this file type, and also where we need to go in the registry next.

For this example, since the data field in this example says "WinRAR.ZIP" we'll need to browse down to the following registry key. (again, the find dialog helps here)

HKEY_CLASSES_ROOT\WinRAR.ZIP\shell\open\command

What we want to do is copy the shell\open\command section to shell\runas\command. The easiest way to do that is right-click on "command" and then choose Export.

image

Now open up the exported registry file in Notepad and change "open" to "runas" where indicated below:

image

Double-click on the file to enter the information into the registry. Now you'll see that the "runas" section is identical to the "open" section:

image

And now you can right-click on a file and open it as administrator:

image

This example used WinRAR, but this should work for almost any filetype or application. You'll just have to change where you look in the registry.

The Geek is the founder of How-To Geek and a geek enthusiast. This article was written on 03/10/08 and tagged with: Windows Vista, Managing Files and Folders

Daily Email Updates

You can get our how-to articles in your email inbox each day for free. Just enter your email below:


Comments (12)

  1. timothy

    Great writeup!

    I just created the keys manually instead of exporting them into a file, and it worked that way perfectly. Thanks!

  2. jd2066

    Creating the keys manually will work too only if the type is "REG_SZ".
    If the default open key is of type "REG_EXPAND_SZ" you have to do that way with the export or use a registry editor that can create keys with a default value of the type "REG_EXPAND_SZ".
    Most all Microsoft software uses keys of the type "REG_EXPAND_SZ" for the program path.

  3. Gene Thomas

    I don't get it. You say, "Have you ever tried to unzip a file to the Program Files directory in Vista? You'll get all sorts of permission denied errors, and generally be unsuccessful." But I have never had that problem. Generally, I use 7-zip, but the vista installed wizard works too.

  4. The Geek

    @Gene

    If you have UAC disabled you might not get any errors.

  5. jd2066

    Also I don't think this tip is needed with the builtin Vista zip utility.
    I think it supports UAC just fine.

  6. jd2066

    One other thing to add, if you use a program like 7-Zip with UAC on in Vista without Administrator access and you don't get permission denied errors then the write likely got redirected to "C:\Users\[UserName]\AppData\Local\VirtualStore\Program Files" instead of "C:\Program Files".
    If you are the only user of the computer this doesn't really matter as Vista will make the files in the VirtualStore folder appear to programs as if they really exist in C:\.
    The problem comes if you want something to appear in "C:\Program Files" for all users.

  7. Ryan

    Very useful - anyone know of annything similar for XP?

  8. vinay

    hello buddy…….is there any registy editing by which i can always run a program as administrator????

  9. jd2066

    There isn't a registry setting but you can go the properties of a shortcut to a program and on the compatibility tab tell it to "Run As Administrator".
    That will make it always run as administrator.

  10. Ken

    Thanks, this has been driving me crazy.

    Your instructions where perfect and the solution works great.

  11. Jhony

    Hi…I have a little problem…I have a .bat file I configured to renew my IP but it only works if I run it as an administrator…ok..that's fine, I can right click-run as administrator…it will work….BUT
    i need it to run AUTOMATICALLY because I always leave my pc on the whole night and after one download I need to renew my ip adress..but i can't be there (i'm sleeping) :)
    my cuestion is…can i ENABLE the box that says…ALWAYS RUN AS ADMINISTRATOR….????? When I go to properties of the .bat file and then to compabillity in the bottom there is a box that says Always run as administrator but i can't check it….PLEASE HELP!!!!
    ps: Sorry for my english, I'm from Colombia, 16 years old 6-6-08
    Thank You

  12. nightsurfer

    Great !!!


Leave a Comment




Leave your friendly comment here. If you have a computer help question, leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Sponsored Links
Getting Started
About How-To Geek
Popular Articles

Copyright © 2006-2008 HowToGeek.com. All Rights Reserved.