PowerShellTabCollection 对象The PowerShellTabCollection Object
本文内容
PowerShellTab 集合对象是 PowerShellTab 对象的集合。每个 PowerShellTab 对象充当一个单独的运行时环境。它是 Microsoft.PowerShell.Host.ISE.PowerShellTabs 类的实例。例如 $psISE.PowerShellTabs 对象。
方法Methods
添加()Add()
在 Windows PowerShell ISE 2.0 和更高版本中受支持。
向集合中添加一个新的 PowerShell 选项卡。它将返回新添加的选项卡。
1. $newTab = $psISE.PowerShellTabs.Add()
2. $newTab.DisplayName = 'Brand New Tab'
Remove(Microsoft.PowerShell.Host.ISE.PowerShellTab psTab)Remove(Microsoft.PowerShell.Host.ISE.PowerShellTab psTab)
在 Windows PowerShell ISE 2.0 和更高版本中受支持。
删除由 psTab 参数指定的选项卡。
psTab 要删除的 PowerShell 选项卡。
1. $newTab = $psISE.PowerShellTabs.Add()
2. Change the DisplayName of the new PowerShell tab.
3. $newTab.DisplayName = 'This tab will go away in 5 seconds'
4. sleep 5
5. $psISE.PowerShellTabs.Remove($newTab)
SetSelectedPowerShellTab(Microsoft.PowerShell.Host.ISE.PowerShellTab psTab)SetSelectedPowerShellTab(Microsoft.PowerShell.Host.ISE.PowerShellTab psTab)
在 Windows PowerShell ISE 2.0 和更高版本中受支持。
选择由 psTab 参数指定的 PowerShell 选项卡,以使它当前是处于活动状态的 PowerShell 选项卡。
psTab 要选择的 PowerShell 选项卡。
1. # Save the current tab in a variable and rename it
2. $oldTab = $psISE.CurrentPowerShellTab
3. $psISE.CurrentPowerShellTab.DisplayName = 'Old Tab'
4. # Create a new tab and give it a new display name
5. $newTab = $psISE.PowerShellTabs.Add()
6. $newTab.DisplayName = 'Brand New Tab'
7. # Switch back to the original tab
8. $psISE.PowerShellTabs.SelectedPowerShellTab = $oldTab
