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

[玩转系统] ISENippet对象

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

ISENippet对象


ISESnippet 对象是 Microsoft.PowerShell.Host.ISE.ISESnippet 类的实例。 $psISE.CurrentPowerShellTab.Snippets 集合的成员都是 ISESnippet 对象的示例。创建代码片段的最简单方法是使用 New-IseSnippet cmdlet。

特性

作者

在 Windows PowerShell ISE 3.0 及更高版本中受支持,但在早期版本中不存在。

获取代码片段作者姓名的只读属性。

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

CodeFragment

在 Windows PowerShell ISE 3.0 及更高版本中受支持,但在早期版本中不存在。

获取要插入编辑器的代码片段的只读属性。

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

捷径

在 Windows PowerShell ISE 3.0 及更高版本中受支持,但在早期版本中不存在。

获取菜单项的 Windows 键盘快捷键的只读属性。

# 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

参见

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

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

取消回复欢迎 发表评论:

关灯