Objekt ISEFileCollection

ISEFileCollection objekt je kolekce ISEFile objects. Příkladem je $psISE.CurrentPowerShellTab.Files kolekce.

Metody

Add( [FullPath] )

Podporováno v prostředí Windows PowerShell ISE 2.0 a novějším.

Vytvoří a vrátí nový soubor bez názvu a přidá ho do kolekce. Vlastnost IsUntitled nově vytvořeného souboru je $true.

[FullPath] – Volitelný řetězec Plně zadaná cesta k souboru. Výjimka se vygeneruje, pokud zahrnete parametr FullPath a relativní cestu, nebo pokud místo úplné cesty použijete název souboru.

# 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( Soubor; [Force] )

Podporováno v prostředí Windows PowerShell ISE 2.0 a novějším.

Odebere zadaný soubor z aktuální karty PowerShellu.

Soubor – Řetězec souboru ISEFile, který chcete odebrat z kolekce. Pokud soubor nebyl uložen, tato metoda vyvolá výjimku. K vynucení odebrání neuloženého souboru použijte parametr Vynucení přepínače.

[Vynutit] - Volitelná logická hodnota Pokud je nastavena na $true, uděluje oprávnění k odebrání souboru, i když nebyl uložen po posledním použití. Výchozí hodnota je $false.

# Removes the first opened file from the file collection associated with the current PowerShell tab.
# If the file has not 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 has not been saved.
$firstfile = $psISE.CurrentPowerShellTab.Files[0]
$psISE.CurrentPowerShellTab.Files.Remove($firstfile, $true)

SetSelectedFile( selectedFile )

Podporováno v prostředí Windows PowerShell ISE 2.0 a novějším.

Vybere soubor určený parametrem SelectedFile .

SelectedFile – Microsoft.PowerShell.Host.ISE.ISEFile Soubor ISEFile, který chcete vybrat.

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

Viz také