共用方式為


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

另請參閱