El objeto ISEFileCollection es una colección de objetos ISEFile. La colección de archivos asociada a un objeto PowerShellTab es un miembro de esta clase. Un ejemplo es la colección $psISE.CurrentPowerShellTab.Files.

Métodos

Add()

Crea y devuelve un nuevo archivo sin título y lo agrega a la colección. El valor de la propiedad IsUntitled del archivo recién creado es true.

# Adds a new file to the collection of files in the current PowerShell tab.
$newFile = $psISE.CurrentPowerShellTab.Files.Add() 
# Add the date as the first line of text in the new file.
$newFile.Editor.Text = "#" + (Get-Date) 

Add(string fullPath)

Agrega un archivo especificado por el parámetro fullPath a la colección de archivos. El valor de la propiedad IsUntitled del archivo recién creado es false.

Nota:

Este método produce una excepción si se usa una ruta de acceso relativa o un nombre de archivo en lugar de la ruta de acceso completa.

fullpath
Ruta de acceso totalmente especificada del archivo.

# Adds the file specified by its fullpath to the collection of files in the current PowerShell tab.
$psISE.CurrentPowerShellTab.Files.Add("$pshome\Examples\profile.ps1")

Remove(Microsoft.PowerShell.Host.ISE.ISEFile file)

Quita un archivo especificado de la ficha de PowerShell actual.

file
Archivo ISEFile que desea quitar de la colección. Si el archivo no se ha guardado, este método produce una excepción. Utilice la siguiente invalidación para forzar la eliminación de un archivo no guardado.

# Removes the first opened file from the file collection associated with the current PowerShell tab.
$firstfile = $psISE.CurrentPowerShellTab.Files[0]
$psISE.CurrentPowerShellTab.Files.Remove($firstfile)

Remove(Microsoft.PowerShell.Host.ISE.ISEFile file, bool force)

Quita un archivo especificado de la ficha de PowerShell actual.

file
Archivo ISEFile que desea quitar de la colección.

force
Parámetro booleano que proporciona permiso para quitar el archivo aunque no se haya guardado desde la última vez que se usó.

# Removes the first opened file from the file collection associated with the current PowerShell tab.
$firstfile = $psISE.CurrentPowerShellTab.Files[0]
$psISE.CurrentPowerShellTab.Files.Remove($firstfile, $true)

SetSelectedFile(Microsoft.PowerShell.Host.ISE.ISEFile selectedFile)

Selecciona el archivo especificado por el parámetro selectedFile.

selectedFile
Archivo ISEFile que desearía seleccionar.

# Selects the specified file.
$firstfile = $psISE.CurrentPowerShellTab.Files[0]
$psISE.CurrentPowerShellTab.Files.SetSelectedFile($firstfile)

Vea también




Tabla de contenido