Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Run Windows 8 Applications as Administrator by Default

0.00/5 (No votes)
11 Jul 2014 2  
Run Windows 8 Applications as Administrator by Default

Introduction

Are you tired of opening a command prompt while in a user account with Administrator privileges, and then running your command only to have it deny you access to it? Are you tired of other security warnings and disabilities when you are already the Administrator?

Well then this tutorial is for you. It is a simple and effective method to bypass the overprotective operating system.

Solution

The workaround to solve the problem cause by another respectfulness from Microsoft towards its customers, is a small registry hack. All you need to do, is to add your application's full path to the following path in Registry under Current User key:

Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers

For people who don't like to tweak their computer's registery directly, I created a simple tool which does the same trick for them.

 

Screenshot

Code: http://www.codeproject.com/KB/miscctrl/795876/AdminRighter.zip
Bin: http://www.codeproject.com/KB/miscctrl/795876/Bin.zip

 

NOTE:

I noticed some fellas suggest disabling UAC as an approach. Please note that disabling UAC will break all Metro Store app.

Using the code

Here is what we do in code

 var key = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers");
if (key != null)
{
     var existingValue = key.GetValue("Full Application Path");
     if (existingValue == null)
        {
          key.SetValue("Full Application Path", "^ RUNASADMIN", RegistryValueKind.String);
          key.Close();
          }
         }
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here