# Run as Administrator greyed out on shortcut

I have a shortcut to a program that only works when run as administrator but in the shortcuts advanced options "always run as administrator" is greyed out. I've looked at the other similar questions but none apply to my issue. UAC is enabled, I am an administrator and i have no idea how to run it in cmd.

• The program is in a network? Programs in a network won't run as administrator. Feb 20, 2015 at 9:51
• Of course you would prefer to set & forget "always run as administrator", but, until you get that working, you can right click the icon and select "run as administrator,", although you will have to do that every time that your want to run it. Feb 20, 2015 at 10:00
• @Earendul The program isnt in a network. Feb 20, 2015 at 11:51
• @Mawg I'm not sure why but right click the shortcut doesn't bring up the option to run as admin, even though i can click the original .exe and run that as admin Feb 20, 2015 at 11:52
• @man-qa - Sounds like you are not actually an Administrator domain permissions overrule your local permissions. Feb 25, 2015 at 15:42

You may be able to use the run as administrator available on the compatibility tab.

One way third party way would be with nircmd. http://www.nirsoft.net/utils/nircmd2.html#elevate

• The author indicated this option is grayed out. Feb 25, 2015 at 15:27
• No they did not. They stated the option was greyed out on the advanced options on the shortcut tab. I was referring to the spot on the compatibility tab. Feb 25, 2015 at 18:58
• @birdman3131 Wow i didn't expect this to work but it did. Thanks birdman :) Feb 26, 2015 at 11:53

It works if you add the executable to the shortcut target. For example:

Right-click on the shortcut and change the target from:

C:\Scripts\helloworld.js

to

wscript.exe C:\Scripts\helloworld.js

(or)

cscript.exe C:\Scripts\helloworld.js

Then the Run as Administrator checkbox is activated in properties.

Eg:

for a python script add in the target field:

"C:\Users\......\Python36\python.exe" "C:\Users\......\test.py"

For PowerShell script add this in the target:

powershell.exe -command "& 'C:\A path with spaces\MyScript.ps1'"

(if you want to also pass some args see this)

Don't forget to check the "run as admin" after...

All the glory to Ramesh Srinivasan

It seems as though the "run as administrator" context menu option and/or shortcut checkbox are unavailable for batch files/scripts. This was answered for PowerShell here: How to run script as administrator?

I don't have an answer yet for running a common batch file.

This seems to happen when a shortcut points to an object identifier rather than a directory path.

You can tell if this is the case because the target in the shortcut properties is something like {0AFACED1-E828-11D1-9187-B532F1E9575D} instead of a directory path.

If you want to create a shortcut to something in C:\Windows\System32, create the shortcut directly off an item in that folder, rather than trying to create it from an existing shortcut on the start menu.

• That's not the only way this can happen; I think it can also happen when you need admin in order to modify the shortcut file. At any rate, I'm seeing this with a path-based shortcut that was put on my start menu by an installer. Oh, it could also be because the target is an .ini file, not an executable...
– SamB
Dec 14, 2015 at 18:50
• When I try creating a shortcut to hosts, it says cannot create shortcut here, would you like it on the desktop instead; but why am I suffering through this even when I am admin on this box ?? May 2, 2017 at 11:21
• I have this problem on a python script shortcut Oct 15, 2018 at 14:37

The fix is to create a shortcut to the executable that needs to be run as admin (if you want to workaround the ugly code for invoking the UAC prompt). After creating the new shortcut, right-click on it and select Properties, then click the Shortcut tab, then the Advanced... button and finally check the Run as Administrator checkbox.

• This is a nice little workaround. I was able to make a shortcut to my "hosts" file using this technique with Visual Studio Code. Example shortcut: "C:\Users\quantastical\AppData\Local\Programs\Microsoft VS Code\Code.exe" "C:\Windows\system32\drivers\etc\hosts" Jan 3, 2019 at 2:38

This seems to happen with file types windows doesn't recognize/trust. But I just found a simple solution for this.

Make a shortcut to cmd.exe (c:\windows\system32\cmd.exe), and replace the Target field with this

C:\windows\System32\cmd.exe /c start "" "c:\path\to\your.file"


Now you should be able to enable the "Run as administrator" on the Advanced tab

Caveats:

• On windows 10, running as administrator seems to have a different set of network drives, try to use absolute UNC paths rather than mapped drives
• If you need to pass parameters please check here for some documentation for the Start command

Why do we use Start instead of just opening it with cmd.exe?

• If you just run the file using a shortcut to cmd.exe /c c:\path\to\your.file, you're stuck with an empty black window open so long as your program is running

How does using Start work around this?

1. It starts a cmd instance with the /c flag which closes it after it's command finishes running
2. It then runs Start which is a native command in cmd.exe that opens a "program" in a new window
3. The way the Start command works if it's not an executable the launch gets passed up to Windows, which then opens it using the associated program for that file type
4. Once the launch is started, the Start command ends which then lets the cmd.exe window close
1. Go to the properties of shortcut file
2. Click on shortcut tab
3. add "powershell.exe" before the path of file in Target

it should look like below:

powershell.exe -file "H:\Powershell\MyPoshScript.ps1"

1. Click apply
3. Run as administrator now selectable.
4. Check Run as administrator and apply --> OK

Done

reference from: How to run script as administrator?

• This option worked for me trying to start a service. Shortcuts to both a batch file running net start Spooler and a Powershell script running Start-Service Spooler both had Run as Administrator greyed out. Changing the shortcut target to cmd.exe /c "blah" and powershell.exe -file "blah" worked. Apr 23 at 10:31

I had this issues on a Windows Server 2008 R2 SP1 system when running shortcuts to run batch files/VBScripts to sync and eject USB disks, or to shutdown Hyper-V systems in preparation for staff to reboot the server cleanly.

Found when I right-clicked the icon, selected properties, then selected the Advanced button next to Change Icon. Select the Run As Administrator option then Save. If UAC is enabled, it will still ask for permission to run, but it will now run properly.

My icon was copied to the quick launch bar. The option to run as administrator was greyed out. So I started again and I deleted the shortcut i had previously tried to set.

This is how i solved the issue.

Opened my start menu, found the icon I wanted, properties, open file location. (This opened the file location of the shortcut from my start menu - perfect).

Now I selected the shortcut icon and copied it.

I then right click on my quick launch bar, "Open Folder" and pasted a copy of my shortcut there.

BrianD gave the best answer and Ross in How to run script as administrator? explained it:

Instead of using the compatibility tab (where the option is greyed out ) use the Advanced button on the Shortcut Tab

This is valid for Windows7 at least.

I was trying for Control Panel to "Run as admin", but it was greyed out for a standard user. Solved by opening C:\Windows\System32, right-clicked on Control and created the shortcut on the desktop. Now this shortcut is available with "Run as administrator" on right-click.