How to start a program as administrator through a pinned to taskbar shortcut, through one of the "recent" files

51

7

I'll try to explain my situation:

I am a developer and use Visual Studio. I always want to run Visual Studio as administator. I have pinned a shortcut to the task bar and in its properties set it to start Visual Studio as administrator. This works fine.

When I right click on the pinned shortcut, I see a list of recent and pinned solutions. I usually open Visual Studio by clicking one of those pinned solutions.

When I click one of those recent or pinned solutions, I do not get a UAC prompt. I remember that before I would always get this (at least, I think I remember).

Is there anything I can do to make Visual Studio run as administrator when I click on those recent or pinned solutions?

Matthijs Wessels

Posted 2012-03-28T08:06:27.950

Reputation: 711

Answers

37

I found this page by looking for something as trivial as to set up a task bar shortcut to always run the command prompt as administrator.

Richard's answer will work with programs that are not considered to be part of Windows' install (i.e. Visual Studio here), but probably not for stuff in C:\Windows\System32 for instance.

Luckily you can set Run as administrator option from the shortcut in this case.

  1. Right-click the shortcut in your task bar
  2. Right-click the program's name (say Command prompt for instance)
  3. Click on Properties
  4. Click the Shortcut tab
  5. Click the Advanced... button
  6. Check the Run as administrator check box
  7. Click the OK button
  8. Click the previous OK button

Mena

Posted 2012-03-28T08:06:27.950

Reputation: 471

This is a much better answer than the one above, IMHO. – Andy Brown – 2016-04-27T12:57:29.200

This is solves the problem way better than the accepted answer. – sanepete – 2016-09-24T17:59:33.833

This should be the more accepted approach. Cleaner, easier, and works perfectly. – Corey Witherow – 2016-10-07T12:30:25.623

1This option does not work if you try to use a jump list item. If you launch it directly it does launch as administrator, try and launch using the recent items and it launches as normal. The first option does work. – tsells – 2017-01-30T19:02:19.060

1This does not answer the question. If you click on one of the "pinned" solutions in the pop-up list, it will not be opened in VS "as administrator". – Svein Terje Gaup – 2017-06-01T04:50:21.207

36

The trick is to change the compatibility settings (i.e. always run as administrator) for the executable (devenv.exe), not the shortcut. After you make the change you may need to re-associate the .sln extension with devenv.exe

There's a blog post at mo.notono.us explaining how this is done.

Edit: If the compatibility tab is missing on the devenv.exe then use the compatibility troubleshooter to enable it - No compatibility tab for Devenv.exe (VS 2010 and VS 2012) on Windows 8

Richard Banks

Posted 2012-03-28T08:06:27.950

Reputation: 461

2Thanks for your answer, this seems to be the answer I'm looking for, but I can't get it to work. I don't have the compatibility tab, but the compatibility troubleshooter solution also doesn't work. It says "Settings applied: User Account Control: Run as administrator". I click "Start the program" and it just starts. I click next and tell it to save the settings. But I still don't get the UAC prompt when I start Visual Studio through the jump list. – Matthijs Wessels – 2012-08-30T08:16:38.987

1

Search for "Visual Studio" to locate your devenv.exe

Or, if you know where it is:

  • Right click on it
  • Click on properties
  • Click on the "Compatibility" tab

You should see a checkbox that says "Run this program as an adminstrator" under privilege level setting

  • check the checkbox
  • un-pin visual studio from the taskbar.
  • drag the denenv icon to the taskbar to pin it on it

Now if you click on the shortcut on the taskbar, it should run as administrator

core_pro

Posted 2012-03-28T08:06:27.950

Reputation: 11

I don't think he has to re-pin it. The compatibility setting is stored globally for devenv.exe in the registry. – Ray – 2014-04-22T08:36:28.470