ISEMenuItemCollection オブジェクト

ISEMenuItemCollection オブジェクトは、ISEMenuItem オブジェクトのコレクションです。 これは Microsoft.PowerShell.Host.ISE.ISEMenuItemCollection クラスのインスタンスです。 例としては、Windows PowerShell® Integrated Scripting Environment (ISE) の [アドオン] メニューをカスタマイズするために使用される $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus オブジェクトです。

方法

Add(string DisplayName, System.Management.Automation.ScriptBlock Action, System.Windows.Input.KeyGesture Shortcut )

Windows PowerShell ISE 2.0 以降でサポートされています。

メニュー項目をコレクションに追加します。

DisplayName 追加するメニューの表示名。

Action このメニュー項目に関連付けられるアクションを指定する System.Management.Automation.ScriptBlock オブジェクト。

Shortcut アクションのキーボード ショートカット。

Returns 追加した ISEMenuItem オブジェクト。

# Create an Add-ons menu with an 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()

参照