ISEMenuItemCollection 是 ISEMenuItem 对象的集合。它是 Microsoft.PowerShell.Host.ISE.ISEMenuItemCollection 类的一个实例。例如用于在 Windows PowerShell 集成脚本环境 (ISE) 中自定义菜单的 $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus 对象。
方法
Add(string displayName, System.Management.Automation.ScriptBlock action, System.Windows.Input.KeyGesture shortcut)
向集合中添加菜单项
- displayname
- 要添加的菜单的显示名称。
- action
- System.Management.Automation.ScriptBlock,用于指定与此菜单项关联的操作。
- shortcut
- 操作的快捷方式。它属于 System.Windows.Input.KeyGesture 类型。
- Returns:
- 刚添加的 ISEMenuItem。
# Create an Add-ons menu with an accessor. # Note the use of “_” as opposed to the “&” for mapping to the accelerator for the menu item. $menuAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P")
另请参阅