如何在Sublime Text 3中使用Terminal以管理员身份运行PowerShell?
以下是默认配置:
{
// The command to execute for the terminal, leave blank for the OS default
// See https://github.com/wbond/sublime_terminal#examples for examples
"terminal": "",
// A list of default parameters to pass to the terminal, this can be
// overridden by passing the "parameters" key with a list value to the args
// dict when calling the "open_terminal" or "open_terminal_project_folder"
// commands
"parameters": [],
// An environment variables changeset. Default environment variables used for the
// terminal are inherited from sublime. Use this mapping to overwrite/unset. Use
// null value to indicate that the environment variable should be unset.
"env": {}
}
答案 0 :(得分:3)
选项1:以管理员身份运行Sublime Text。终端插件启动的过程也将在管理员用户下运行。小心 - 第三方插件也具有管理员权限。
选项2:配置终端插件以启动以管理员身份运行的新PowerShell实例:
"terminal": "powershell.exe",
"parameters": [
"-WindowStyle", "Hidden",
"-Command", "Start-Process", "-Verb", "RunAs", "powershell.exe",
"-ArgumentList", "'-NoExit', '-Command', Set-Location, \"'$PWD'\""
],
此配置启动一个命令,用于在管理员用户下重新启动PowerShell。我们手动重置工作目录,因为新实例在不同的进程空间中启动。启用UAC后,我们需要在UAC提示符中确认执行升级权限。如果需要,我们可以disable the prompt获取特定计划。
答案 1 :(得分:0)
这是一篇使用插件与您的用例对话的文章。
“如果Sublime允许你从弹出终端运行bash或PowerShell,那会不会很棒?”
sublimetexttips.com/how-to-open-terminal-or-powershell-from-your-sublime-project