Share via


Objet PowerShellTabCollection

L’objet collection PowerShellTab est une collection d’objets PowerShellTab. Chaque objet PowerShellTab fonctionne comme un environnement d’exécution distinct. Il s’agit d’une instance de la classe Microsoft.PowerShell.Host.ISE.PowerShellTabs. L’objet $psISE.PowerShellTabs en est un exemple.

Méthodes

Add()

Prise en charge dans Windows PowerShell ISE 2.0 et versions ultérieures.

Ajoute un nouvel onglet PowerShell à la collection. Elle retourne l’onglet qui vient d’être ajouté.

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

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

Prise en charge dans Windows PowerShell ISE 2.0 et versions ultérieures.

Supprime l’onglet spécifié par le paramètre psTab.

psTab Onglet PowerShell à supprimer.

$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)

Prise en charge dans Windows PowerShell ISE 2.0 et versions ultérieures.

Sélectionne l’onglet PowerShell qui est spécifié par le paramètre psTab pour le définir comme onglet PowerShell actuellement actif.

psTab Onglet PowerShell à sélectionner.

# 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

Voir aussi