ISESnippetObject

Obiekt ISESnippet jest wystąpieniem klasy Microsoft.PowerShell.Host.ISE.ISESnippet. Elementy członkowskie kolekcji $psISE.CurrentPowerShellTab.Snippets to wszystkie przykłady obiektów ISESnippet . Najprostszym sposobem utworzenia fragmentu kodu jest użycie polecenia cmdlet New-IseSnippet .

Właściwości

Autor

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Właściwość tylko do odczytu, która pobiera nazwę autora fragmentu kodu.

# Get the author of the first snippet item
$psISE.CurrentPowerShellTab.Snippets.Item(0).Author

CodeFragment

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Właściwość tylko do odczytu, która pobiera fragment kodu do wstawienia do edytora.

# Get the code fragment associated with the first snippet item.
$psISE.CurrentPowerShellTab.Snippets.Item(0).CodeFragment

Skrót

Obsługiwane w programie Windows PowerShell ISE 3.0 lub nowszym i nie są obecne we wcześniejszych wersjach.

Właściwość tylko do odczytu, która pobiera skrót klawiaturowy systemu Windows dla elementu menu.

# Get the shortcut for the first submenu item.
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear()
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('_Process', {Get-Process}, 'Alt+P')
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus[0].Shortcut

Zobacz też