Compartilhar via


O Objeto ISEFileCollection

O objeto ISEFileCollection é uma coleção de objetos ISEFile . Um exemplo é a $psISE.CurrentPowerShellTab.Files coleção.

Methods

Add( [FullPath] )

Suportado no Windows PowerShell ISE 2.0 e versões posteriores.

Cria e retorna um novo arquivo sem título e o adiciona à coleção. A propriedade IsUntitled do arquivo recém-criado é $true.

  • [FullPath] - String opcional - O caminho totalmente especificado do arquivo. Uma exceção é gerada se você incluir o parâmetro FullPath e um caminho relativo, ou se usar um nome de arquivo em vez do caminho completo.
# Adds a new untitled file to the collection of files in the current PowerShell tab.
$newFile = $psISE.CurrentPowerShellTab.Files.Add()

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

Remove( File, [Force] )

Suportado no Windows PowerShell ISE 2.0 e versões posteriores.

Remove um arquivo especificado da aba atual do PowerShell.

Arquivo - Stringa O arquivo ISEFile que você deseja remover da coleção. Se o arquivo não foi salvo, esse método lança uma exceção. Use o parâmetro de interruptor de força para forçar a remoção de um arquivo não salvo.

[Forçar] - Booleano opcional Se definido como $true, concede permissão para remover o arquivo mesmo que ele não tenha sido salvo após o último uso. O padrão é $false.

# Removes the first opened file from the file collection associated with the current
# PowerShell tab.  If the file hasn't yet been saved, then an exception is generated.
$firstfile = $psISE.CurrentPowerShellTab.Files[0]
$psISE.CurrentPowerShellTab.Files.Remove($firstfile)

# Removes the first opened file from the file collection associated with the current
# PowerShell tab, even if it hasn't been saved.
$firstfile = $psISE.CurrentPowerShellTab.Files[0]
$psISE.CurrentPowerShellTab.Files.Remove($firstfile, $true)

SetSelectedFile( selectedFile )

Suportado no Windows PowerShell ISE 2.0 e versões posteriores.

Seleciona o arquivo especificado pelo parâmetro SelectedFile .

SelectedFile - Microsoft.PowerShell.Host.ISE.ISEFile O arquivo ISEFile que você deseja selecionar.

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

Consulte Também