以管理员身份重新打开 SublimeText

Des*_*ley 7 plugins notepad++ sublime-text-3

是否有一个 SublimeText 插件可以以管理员身份重新打开当前文件?

notepad++ 有一个功能,如果你打开一个文件,但没有编辑它的权限,但尝试保存,它会通知你你没有访问权限,然后给你打开一个选项admin(如果您有该权限),之后您可以保存。

我意识到有一些变通方法,但这是一个非常方便的功能,我很想在 SublimeText 中看到。

澄清一下,我不希望能够在 Windows 资源管理器中右键单击文件,然后“打开为”。我知道允许这种情况发生的工具,我特别谈论的是一旦文件以非管理员身份打开,并且需要管理员权限才能保存。

ZXX*_*ZXX 0

转到 gpedit 并设置这些策略:

Windows Setings/Security Settings/Local Policies/Security Options

User Account Control: Admin Approval Mode for the Built-in Administrator account    Disabled
User Account Control: Allow UIAccess applications to prompt for elevation without using the secure desktop  Disabled
User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode    Elevate without prompting
User Account Control: Behavior of the elevation prompt for standard users   Prompt for credentials
User Account Control: Detect application installations and prompt for elevation Disabled
User Account Control: Only elevate executables that are signed and validated    Disabled
User Account Control: Only elevate UIAccess applications that are installed in secure locations Disabled
User Account Control: Run all administrators in Admin Approval Mode Disabled
User Account Control: Switch to the secure desktop when prompting for elevation Disabled
User Account Control: Virtualize file and registry write failures to per-user locations Enabled
Run Code Online (Sandbox Code Playgroud)

然后将编辑器设置为始终以管理员身份运行的兼容模式。

如果您遇到一些问题,您可以将“内置管理员帐户的管理员批准模式”放宽为“启用”,只要保持“提升而不提示”即可。

您甚至可以跳过应用程序的兼容性设置,因为这些策略将为您提供自动和静默的提升。取决于操作系统的特定版本(LTSB 版本非常宽松,Home 版本非常极权)。

对于某些系统文件夹,您必须确保正在运行 x64 构建。这是一个不同的问题,对人们来说看起来像 UAC,但事实并非如此。只有 Visual Studio 知道如何默默地回避这个问题。

对于像字体这样的“特别”文件夹,所有这些都不会帮助您。如果你想通过 UI 进入,你将不得不跳过更多的跃点(包括重命名 C:\Windows\Fonts\desktop.ini),但你可以通过 admim cmd 控制台进入。

因此,将您的编辑器添加到路径中,保持一个管理命令始终打开,生活就美好了。