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.


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


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.


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.