PowerShellTabCollection 对象

PowerShellTab 集合对象是一组 PowerShellTab 对象。 每个 PowerShellTab 对象都作为独立的运行时环境运行。 它是 Microsoft.PowerShell.Host.ISE.PowerShellTabs 类的一个实例。 一个例子是物体。$psISE.PowerShellTabs

Methods

Add()

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

在集合中添加了一个新的 PowerShell 标签页。 它会返回新添加的标签页。

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

Remove(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

另请参阅