Partager via


L’objet PowerShellTabCollection

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

Méthodes

Add()

Pris en charge sous Windows PowerShell ISE 2.0 et versions ultérieures.

Ajoute un nouvel onglet PowerShell à la collection. Il renvoie l’onglet nouvellement ajouté.

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

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

Pris en charge sous Windows PowerShell ISE 2.0 et versions ultérieures.

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

  • psTab - L’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)

Pris en charge sous Windows PowerShell ISE 2.0 et versions ultérieures.

Sélectionne l’onglet PowerShell spécifié par le paramètre psTab pour en faire l’onglet PowerShell actuellement actif.

  • psTab - L’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