Visual Studio 以管理员身份运行快捷方式

发布于 2024-09-30 23:35:13 字数 105 浏览 1 评论 0原文

如何创建以管理员权限运行 Visual Studio 的快捷方式?

实际上,我必须导航到 Visual Studio 开始菜单文件夹,用鼠标右键单击图标并选择“以管理员身份运行”。

how do I create a shortcut that runs Visual Studio with Administrator rights?

Actually I have to navigate to the Visual Studio start menu folder, click on the icon with the right mous button and choose "Run as Administrator".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

つ低調成傷 2024-10-07 23:35:13

右键单击该快捷方式,选择属性。在“快捷方式”选项卡上,单击“高级”按钮(右下角)。选中“以管理员身份运行”框。

Right-click on the shortcut, select Properties. On the Shortcut tab, click the Advanced button (bottom right). Check the Run As Administrator box.

就是爱搞怪 2024-10-07 23:35:13

我知道OP是关于如何创建一个以管理员身份运行VS的快捷方式,但是使用下面的步骤您可以始终以管理员身份启动VS。

这是我的回答的副本关于超级用户的类似帖子

选项 1 - 将 VSLauncher.exe 和 DevEnv.exe 设置为始终以管理员身份运行

要让 Visual Studio 在打开任何 .sln 文件时始终以管理员身份运行

  1. 导航到C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe
  2. 右键单击 VSLauncher.exe 并选择兼容性疑难解答
  3. 选择疑难解答程序
  4. 选中该程序需要额外权限,然后单击“下一步”。
  5. 单击测试程序...按钮启动 VS。
  6. 单击“下一步”,然后单击是,保存该程序的这些设置,然后单击关闭按钮。

要让 Visual Studio 在直接打开 Visual Studio 时始终以管理员身份运行,请对 DevEnv.exe 文件执行相同的操作。这些文件位于:

Visual Studio 2010

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

Visual Studio 2012

C:\Program Files (x86) )\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe

Visual Studio 2013

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe

Visual Studio 2015

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe

选项 2 - 使用 Visual Studio 的 VSCommands 扩展

安装免费的 Visual Studio 的 VSCommands 扩展(位于 Visual Studio 扩展库),然后通过转到“工具”->“Visual Studio 扩展库”将其配置为始终让 Visual Studio 以管理员权限启动。 VS 命令 ->选项-> IDE 增强 ->常规并选中始终以提升的权限启动 Visual Studio,然后单击“保存”按钮。

注意: VSCommands 目前不适用于 VS 2015,但他们的网站表示他们正在努力更新它以支持 VS 2015。

我的意见

我更喜欢选项 2,因为:

  • 它还允许您轻松关闭此功能功能。
  • VSCommands 附带了许多其他很棒的功能,所以无论如何我总是安装它。
  • 它比选项 1 更容易做到。

I know the OP was about how to create a shortcut that runs VS as admin, but using the steps below you can just always have VS launch as admin.

This is a copy of my answer to a similar post on SuperUser:

Option 1 - Set VSLauncher.exe and DevEnv.exe to always run as admin

To have Visual Studio always run as admin when opening any .sln file:

  1. Navigate to C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe.
  2. Right-click on VSLauncher.exe and choose Troubleshoot compatibility.
  3. Choose Troubleshoot program.
  4. Check off The program requires additional permissions and hit Next.
  5. Click the Test the program... button to launch VS.
  6. Click Next, then hit Yes, save these settings for this program, and then the close buton.

To have Visual Studio always run as an admin when just opening visual studio directly, do the same thing to the DevEnv.exe file(s). These file are located at:

Visual Studio 2010

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

Visual Studio 2012

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe

Visual Studio 2013

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe

Visual Studio 2015

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe

Option 2 - Use VSCommands extension for Visual Studio

Install the free VSCommands extension for Visual Studio (it's in the Visual Studio Extensions Gallery) and then configure it to always have Visual Studio start with admin privileges by going to Tools -> VSCommands -> Options -> IDE Enhancements -> General and check off Always start Visual Studio with elevated permissions and click the Save button.

Note: VSCommands is not currently available for VS 2015, but their site says they are working on updating it to support VS 2015.

My Opinion

I prefer Option 2 because:

  • it also allows you to easily turn off this functionality.
  • VSCommands comes with lots of other great features so I always have it installed anyways.
  • it's just easier to do than option 1.
苏辞 2024-10-07 23:35:13

我正在寻找一种以管理员身份运行 Visual Studio 解决方案文件 (.sln) 的方法。我刚刚找到了一个很好的方法来做到这一点...

将此内容放入名为 RunAsAdministrator.reg 的文件中:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\runas\Command]
@="\"C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\MSEnv\\VSLauncher.exe\" \"%1\""

双击该文件以执行它。

现在,当您右键单击一个文件时,您可以选择以管理员身份运行它,如下所示:

在此处输入图像描述

以下是很棒的 David Ebbo 的完整故事:打开以管理员身份保存您的解决方案文件

What I was looking for was a way of running Visual Studio Solution files (.sln) as Administrator. I just found a pretty good way of doing this...

Place this content inside a file named RunAsAdministrator.reg:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\runas\Command]
@="\"C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\MSEnv\\VSLauncher.exe\" \"%1\""

Double click the file to execute it.

Now, when you right click a file you'll have the option of running it as Adminstrator like this:

enter image description here

Here's the full story by the AWESOME David Ebbo: Open your solution files as admin

你怎么敢 2024-10-07 23:35:13
  1. 在桌面上创建 Visual Studio 的快捷方式
    1. 右键单击该程序
    2. “发送至”
    3. “桌面(创建快捷方式)”
  2. 打开属性
    1. 右键单击快捷方式
    2. “属性”
  3. 在“快捷方式”选项卡中,单击“高级...”(位于右下角)
  4. 在新窗口中选择“以管理员身份运行”
  5. 应用并确定所有窗口。

现在,当您使用此快捷方式时,它应该以管理员身份运行该程序。

  1. Create a shortcut to Visual Studio on your desktop
    1. Right-click on the program
    2. "Send to"
    3. "Desktop (create shortcut)"
  2. Open up properties
    1. Right-click on the shortcut
    2. "Properties"
  3. Within the "Shortcut" tab, click on "Advanced..." (somewhat towards bottom right)
  4. Select "Run as administrator" in the new window
  5. Apply and OK all the windows.

Now when you use this shortcut, it should run the program as administrator.

幸福还没到 2024-10-07 23:35:13

上述答案有效,但在 Windows 10 上,您可能会遇到禁用的高级快捷方式屏幕。因此,对于 Windows 10,请执行以下操作:

  1. 创建解决方案文件的快捷方式
  2. 右键单击​​快捷方式 =>属性
  3. 选择
  4. “目标”下的“快捷方式”选项卡,在 sln 路径之前添加 Visual Studio 可执行文件位置。例如:
    “C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe” C:\mypath\example\example.sln
  5. 在快捷方式选项卡下按“高级” - 您将能够编辑预付款窗口。
  6. 选择“以管理员身份运行”
  7. 按确定
  8. 双击快捷方式 - 您现在应该能够以管理员身份运行解决方案。

The above answers works, but on Windows 10 you might bump with disabled advanced shortcut screen. So for windows 10 do the following:

  1. Create shortcut to the solution file
  2. Right click the shortcut => properties
  3. Choose Shortcut tab
  4. Under Target add the visual studio executable location before the sln path. For example:
    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe" C:\mypath\example\example.sln
  5. Press Advanced under the shortcut tab - you'll be able to edit the advances window.
  6. Select "Run as administrator"
  7. Press ok
  8. Double click the shortcut - you should be able to run the solution as administrator now.
太阳哥哥 2024-10-07 23:35:13

Ctrl + Shift + 单击 Visual Studio 2019 快捷方式似乎会在管理模式下打开 Visual Studio Professional 2019。

Ctrl + Shift + Clicking on Visual Studio 2019 shortcut seems to open Visual Studio Professional 2019 in admin mode.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文