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'

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

另请参阅