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

[玩转系统] PowerShellTabCollection 对象

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

PowerShellTabCollection 对象


PowerShellTab 集合对象是PowerShellTab 对象的集合。每个 PowerShellTab 对象都充当单独的运行时环境。它是 Microsoft.PowerShell.Host.ISE.PowerShellTabs 类的实例。一个示例是 $psISE.PowerShellTabs 对象。

方法

Add()

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

将新的 PowerShell 选项卡添加到集合中。它返回新添加的选项卡。

$newTab = $psISE.PowerShellTabs.Add()
$newTab.DisplayName = 'Brand New Tab'

删除(Microsoft.PowerShell.Host.ISE.PowerShellTab psTab)

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

删除由 psTab 参数指定的选项卡。

psTab 要删除的 PowerShell 选项卡。

$newTab = $psISE.PowerShellTabs.Add()
Change the DisplayName of the new PowerShell tab.
$newTab.DisplayName = 'This tab will go away in 5 seconds'
sleep 5
$psISE.PowerShellTabs.Remove($newTab)

SetSelectedPowerShellTab(Microsoft.PowerShell.Host.ISE.PowerShellTab psTab)

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

选择由 psTab 参数指定的 PowerShell 选项卡,使其成为当前活动的 PowerShell 选项卡。

psTab 要选择的 PowerShell 选项卡。

# Save the current tab in a variable and rename it
$oldTab = $psISE.CurrentPowerShellTab
$psISE.CurrentPowerShellTab.DisplayName = 'Old Tab'
# Create a new tab and give it a new display name
$newTab = $psISE.PowerShellTabs.Add()
$newTab.DisplayName = 'Brand New Tab'
# Switch back to the original tab
$psISE.PowerShellTabs.SelectedPowerShellTab = $oldTab

参见

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

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

取消回复欢迎 发表评论:

关灯