Run as Administrator greyed out on shortcut
Solution 1
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
Solution 2
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
Solution 3
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.
Solution 4
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.
Solution 5
- Go to the properties of shortcut file
- Click on shortcut tab
- add "powershell.exe" before the path of file in Target
it should look like below:
powershell.exe -file "H:\Powershell\MyPoshScript.ps1"
- Click apply
- Click advance button
- Run as administrator now selectable.
- Check Run as administrator and apply --> OK
Done
reference from: How to run script as administrator?
Related videos on Youtube
Comments
-
man-qa over 1 year
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.
-
Franchesco about 9 yearsThe program is in a network? Programs in a network won't run as administrator.
-
Mawg says reinstate Monica about 9 yearsOf 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.
-
man-qa about 9 years@Earendul The program isnt in a network.
-
man-qa about 9 years@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
-
Mawg says reinstate Monica about 9 yearsCan you start it from the command line by using an elevated command prompt? windows.microsoft.com/en-us/windows/…
-
man-qa about 9 years@Mawg Like i said in the question, I have no idea how to run it in cmd
-
Mawg says reinstate Monica about 9 yearsDoes right click offer nothing at all? If you can select Properties, then Target will give you the command line that you need.
-
Moab about 9 yearsMake a new user admin account and log into it, does it still have the issue?
-
man-qa about 9 years@Mawh I can right click it to see the target but I still don't know how to run it in cmd.
-
man-qa about 9 years@Moab I tried to follow your advice but it wouldn't let me create a new admin account as it is a work PC.
-
Moab about 9 yearsSince it is a work PC, contact your computer administrator about the issue.
-
Ramhound about 9 years@man-qa - Sounds like you are not actually an
Administrator
domain permissions overrule your local permissions. -
David Wilson over 8 yearsWhat level is your UAC set to? The always run as administrator is usually only greyed out if UAC is set too low. It should be set to "Notify me when applications try to make changes to my computer (default)"
-
-
Ramhound about 9 yearsThe author indicated this option is grayed out.
-
birdman3131 about 9 yearsNo 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.
-
man-qa about 9 years@birdman3131 Wow i didn't expect this to work but it did. Thanks birdman :)
-
SamB over 8 yearsThat'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... -
killjoy about 7 yearsWhen 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 ??
-
JinSnow over 5 yearsI have this problem on a python script shortcut
-
Jeff Jenkins over 5 yearsThis 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"
-
Alex Essilfie about 3 yearsYour question does not directly answer the question. Please add it as a comment to the question instead.
-
AlainD about 2 yearsThis option worked for me trying to start a service. Shortcuts to both a batch file running
net start Spooler
and a Powershell script runningStart-Service Spooler
both hadRun as Administrator
greyed out. Changing the shortcut target tocmd.exe /c "blah"
andpowershell.exe -file "blah"
worked.