Visual Studio 以管理员身份运行快捷方式
如何创建以管理员权限运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
右键单击该快捷方式,选择属性。在“快捷方式”选项卡上,单击“高级”按钮(右下角)。选中“以管理员身份运行”框。
Right-click on the shortcut, select Properties. On the Shortcut tab, click the Advanced button (bottom right). Check the Run As Administrator box.
我知道OP是关于如何创建一个以管理员身份运行VS的快捷方式,但是使用下面的步骤您可以始终以管理员身份启动VS。
这是我的回答的副本关于超级用户的类似帖子:
选项 1 - 将 VSLauncher.exe 和 DevEnv.exe 设置为始终以管理员身份运行
要让 Visual Studio 在打开任何 .sln 文件时始终以管理员身份运行:
C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe
。VSLauncher.exe
并选择兼容性疑难解答。要让 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,因为:
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:
C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe
.VSLauncher.exe
and choose Troubleshoot compatibility.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:
我正在寻找一种以管理员身份运行 Visual Studio 解决方案文件 (.sln) 的方法。我刚刚找到了一个很好的方法来做到这一点...
将此内容放入名为
RunAsAdministrator.reg
的文件中:双击该文件以执行它。
现在,当您右键单击一个文件时,您可以选择以管理员身份运行它,如下所示:
以下是很棒的 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
: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:
Here's the full story by the AWESOME David Ebbo: Open your solution files as admin
现在,当您使用此快捷方式时,它应该以管理员身份运行该程序。
Now when you use this shortcut, it should run the program as administrator.
上述答案有效,但在 Windows 10 上,您可能会遇到禁用的高级快捷方式屏幕。因此,对于 Windows 10,请执行以下操作:
“C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe” C:\mypath\example\example.sln
The above answers works, but on Windows 10 you might bump with disabled advanced shortcut screen. So for windows 10 do the following:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe" C:\mypath\example\example.sln
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.