El objeto de ficha de PowerShell incluye un entorno de ejecución de Windows PowerShell. Un ejemplo es $psISE.CurrentPowerShellTab.

Métodos

A continuación se enumeran los métodos del objeto de ficha de PowerShell.

Invoke(System.Management.Automation.ScriptBlock script)

Ejecuta el script determinado en la ficha de PowerShell.

Nota:

Este método sólo funciona en otras fichas de PowerShell, no en la ficha de PowerShell donde se ejecuta.

script:
Script que se va a ejecutar.

# Manually create a second PowerShell tab before running this script. 
# Return to the first tab and type
$secondTab = $psise.PowerShellTabs[1] 
$secondTab.Invoke({dir})

Propiedades

AddOnsMenu

Propiedad de solo lectura que obtiene el menú Complementos para la ficha de PowerShell.

# Clear the Add-ons menu if one exists.
$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Clear()
# Create an AddOns menu with an accessor.
# Note the use of “_”  as opposed to the “&” for mapping to the fast key letter for the menu item.
$menuAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("_Process",{get-process},"Alt+P") 
# Add a nested menu. 
$parentAdded = $psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add("Parent",$null,$null) 
$parentAdded.SubMenus.Add("_Dir",{dir},"Alt+D")
# Show the Add-ons menu on the current PowerShell tab.
$psISE.CurrentPowerShellTab.AddOnsMenu

CanInvoke

Propiedad booleana de solo lectura que obtiene un valor true si se puede invocar un script con el método Invoke(System.Management.Automation.ScriptBlock script).

# CanInvoke will be false if the PowerShell
# tab is running a script that takes a while, and you
# check its properties from another PowerShell tab. It is
# always false if checked on the current PowerShell tab. 
# Manually create a second PowerShell tab before
# running this script.
# Return to the first tab and type
$secondTab = $psise.PowerShellTabs[1] 
$secondTab.CanInvoke 
$secondTab.Invoke({sleep 20})
$secondTab.CanInvoke 

Commandpane

Propiedad de solo lectura que obtiene el objeto editor del Panel de comandos.

# Gets the Command Pane editor.
$psISE.CurrentPowerShellTab.CommandPane

DisplayName

Propiedad de lectura y escritura que obtiene o establece el nombre de la ficha de PowerShell.

$newTab = $psise.PowerShellTabs.Add()
# Change the DisplayName of the new PowerShell tab. 
$newTab.DisplayName="Brand New Tab"

ExpandedScript

Propiedad booleana de lectura y escritura que determina si el Panel de scripts se expande u oculta.

# Toggle the expanded script property to see its effect.
$PSise.CurrentPowerShellTab.ExpandedScript=!$PSise.CurrentPowerShellTab.ExpandedScript

Files

Propiedad de solo lectura que obtiene la colección de archivos de script que están abiertos en la ficha de PowerShell.

$newFile = $psISE.CurrentPowerShellTab.Files.Add()
$newFile.Editor.Text = "a`r`nb" 
# Gets the line count. 
$newFile.Editor.LineCount

Output

Propiedad de solo lectura que obtiene el editor de salida.

# Clears the text in the output.
$psise.CurrentPowerShellTab.output.clear()

Prompt

Propiedad de solo lectura que obtiene el texto de solicitud actual.

# Gets the current prompt text.
$psISE.CurrentPowerShellTab.Prompt

StatusText

Propiedad de solo lectura que obtiene el texto de estado de PowerShellTab.

# Gets the current status text,
$psISE.CurrentPowerShellTab.StatusText

Vea también




Tabla de contenido