当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] ISEmenuItemCollection 对象

作者:精品下载站 日期:2024-12-14 02:59:48 浏览:12 分类:玩电脑

ISEmenuItemCollection 对象


ISEMenuItemCollection 对象是 ISEMenuItem 对象的集合。它是 Microsoft.PowerShell.Host.ISE.ISEMenuItemCollection 类的实例。例如,$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus 对象用于自定义 Windows PowerShell® 集成脚本环境 (ISE) 中的附加组件菜单。

方法

添加(字符串 DisplayName、System.Management.Automation.ScriptBlock 操作、System.Windows.Input.KeyGesture 快捷方式)

在 Windows PowerShell ISE 2.0 及更高版本中受支持。

将菜单项添加到集合中。

DisplayName 要添加的菜单的显示名称。

Action System.Management.Automation.ScriptBlock 对象,指定与此菜单项关联的操作。

快捷方式 操作的键盘快捷键。

返回刚刚添加的ISEMenuItem对象。

# Create an Add-ons menu with a fast access key and a shortcut.
# Note the use of "_"  as opposed to the "&" for mapping to the fast access key letter for the menu item.
$menuAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('_Process', {Get-Process}, 'Alt+P')

Clear()

在 Windows PowerShell ISE 2.0 及更高版本中受支持。

从菜单项中删除所有子菜单。

# Remove all custom submenu items from the AddOns menu
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear()

参见

  • ISEmenuItem 对象
  • Windows PowerShell ISE 脚本对象模型的用途
  • ISE 对象模型层次结构

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯