Windows Terminal 是适用于您喜爱的命令行 shell 的现代主机应用程序,例如命令提示符、PowerShell 和 bash(通过适用于 Linux 的 Windows 子系统 (WSL))。其主要功能包括多个选项卡、窗格、Unicode 和 UTF-8 字符支持、GPU 加速文本渲染引擎,以及创建您自己的主题和自定义文本、颜色、背景和快捷方式的能力。 当您右键单击或按住 Shift 键并右键单击文件夹或文件夹背景时,Windows 11默认
包含在 Windows 终端上下文菜单中打开,但这不会打开提升的 Windows 终端(以管理员身份运行)。 本教程将向您展示如何添加或删除
以管理员身份在 Windows 终端中打开Windows 11 中所有用户的上下文菜单。“ 以管理员身份在 Windows 终端中打开”
上下文菜单允许您选择使用默认 shell 配置文件、命令提示符shell 配置文件或Windows PowerShell shell 配置文件将提升的 Windows 终端打开到当前文件夹路径.
您必须以管理员身份登录才能添加、删除和使用“以管理员身份在 Windows 终端中打开”上下文菜单。
示例:“以管理员身份在 Windows 终端中打开”上下文菜单
就是这样:
1个执行下面的第 2 步(添加-右键单击)、第 3 步(添加-Shift+右键单击)或第 4 步(删除)您想要执行的操作。
2个 添加右键单击“以管理员身份在 Windows 终端中打开”上下文菜单
A) 单击/点击下面的下载按钮下载下面的文件,然后转到下面的第 5 步。
Add_Open_in_Windows_Terminal_as_administrator.reg
如果您安装了PowerShell 7并希望将其添加到此上下文菜单,则您可以随后下载并合并下面的Add_PowerShell_7_as_admin.reg文件。
如果您安装了Ubuntu for WSL并且想要将Ubuntu添加到此上下文菜单,那么您可以随后下载并合并下面的Add_Ubuntu_as_admin.reg文件。
(.Add_Open_in_Windows_Terminal_as_administrator.reg 文件内容供参考)
代码:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenWTHereAsAdmin]
"HasLUAShield"=""
"MUIVerb"="Open in Windows Terminal as administrator"
"Extended"=-
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\001flyout]
"MUIVerb"="Default Profile"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\001flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-d','\"\"\"%V\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\002flyout]
"MUIVerb"="Command Prompt"
"Icon"="imageres.dll,-5324"
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\002flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"Command Prompt\"\"\"','-d','\"\"\"%V\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\003flyout]
"MUIVerb"="PowerShell"
"HasLUAShield"=""
"Icon"="powershell.exe"
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\003flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"Windows PowerShell\"\"\"','-d','\"\"\"%1\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWTHereAsAdmin]
"HasLUAShield"=""
"MUIVerb"="Open in Windows Terminal as administrator"
"Extended"=-
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\001flyout]
"MUIVerb"="Default Profile"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\001flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-d','\"\"\"%V\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\002flyout]
"MUIVerb"="Command Prompt"
"Icon"="imageres.dll,-5324"
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\002flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"Command Prompt\"\"\"','-d','\"\"\"%V\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\003flyout]
"MUIVerb"="PowerShell"
"HasLUAShield"=""
"Icon"="powershell.exe"
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\003flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"Windows PowerShell\"\"\"','-d','\"\"\"%V\\.\"\"\"')\""
3个 添加 Shift + 右键单击“以管理员身份在 Windows 终端中打开”上下文菜单
A) 单击/点击下面的下载按钮下载下面的文件,然后转到下面的第 5 步。
Add_Shift+Open_in_Windows_Terminal_as_administrator.reg
如果您安装了PowerShell 7并希望将其添加到此上下文菜单,则您可以随后下载并合并下面的Add_PowerShell_7_as_admin.reg文件。
如果您安装了Ubuntu for WSL并且想要将Ubuntu添加到此上下文菜单,那么您可以随后下载并合并下面的Add_Ubuntu_as_admin.reg文件。
(.reg 文件内容供参考)
代码:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenWTHereAsAdmin]
"HasLUAShield"=""
"MUIVerb"="Open in Windows Terminal as administrator"
"Extended"=""
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\001flyout]
"MUIVerb"="Default Profile"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\001flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-d','\"\"\"%V\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\002flyout]
"MUIVerb"="Command Prompt"
"Icon"="imageres.dll,-5324"
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\002flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"Command Prompt\"\"\"','-d','\"\"\"%V\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\003flyout]
"MUIVerb"="PowerShell"
"HasLUAShield"=""
"Icon"="powershell.exe"
[HKEY_CLASSES_ROOT\Directory\Shell\OpenWTHereAsAdmin\shell\003flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"Windows PowerShell\"\"\"','-d','\"\"\"%1\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWTHereAsAdmin]
"HasLUAShield"=""
"MUIVerb"="Open in Windows Terminal as administrator"
"Extended"=""
"SubCommands"=""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\001flyout]
"MUIVerb"="Default Profile"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\001flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-d','\"\"\"%V\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\002flyout]
"MUIVerb"="Command Prompt"
"Icon"="imageres.dll,-5324"
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\002flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"Command Prompt\"\"\"','-d','\"\"\"%V\\.\"\"\"')\""
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\003flyout]
"MUIVerb"="PowerShell"
"HasLUAShield"=""
"Icon"="powershell.exe"
[HKEY_CLASSES_ROOT\Directory\Background\Shell\OpenWTHereAsAdmin\shell\003flyout\command]
@="powershell.exe -WindowStyle Hidden \"Start-Process -Verb RunAs cmd.exe -ArgumentList @('/c','start wt.exe','-p','\"\"\"Windows PowerShell\"\"\"','-d','\"\"\"%V\\.\"\"\"')\""
4个 删除“以管理员身份在 Windows 终端中打开”上下文菜单
这是默认设置。
A) 单击/点击下面的下载按钮下载下面的文件,然后转到下面的第 5 步。
Remove_Open_in_Windows_Terminal_as_administrator.reg
(.reg文件内容供参考)
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\shell\OpenWTHereAsAdmin]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWTHereAsAdmin]
5个将 .reg 文件保存到您的桌面。
6个双击/点击下载的 .reg 文件以合并它。
7出现提示时,单击/点击运行、是( UAC )、是和确定以批准合并。
8个如果愿意,您现在可以删除下载的 .reg 文件。