Oggetto ISEFileCollection
L'oggetto ISEFileCollection è un insieme di oggetti ISEFile. Un esempio è l'insieme $psISE.CurrentPowerShellTab.Files
.
Metodi
Add( [FullPath] )
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Crea e restituisce un nuovo file senza titolo e lo aggiunge alla raccolta. La proprietà IsUntitled del file appena creato viene $true
.
[FullPath] - Stringa facoltativa Percorso completo del file. Se si include il parametro FullPath e un percorso relativo, viene generata un'eccezione oppure se si usa un nome di file anziché il percorso 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] )
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Rimuove un file specificato dalla scheda corrente di PowerShell.
File - Stringa Il file ISEFile da rimuovere dalla raccolta. Se il file non è stato salvato, questo metodo genera un'eccezione. Usare il parametro switch Force per forzare la rimozione di un file non salvato.
[Force] : valore booleano facoltativo se impostato su $true
, concede l'autorizzazione per rimuovere il file anche se non è stato salvato dopo l'ultimo utilizzo. Il valore predefinito è $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 )
Supportato in Windows PowerShell ISE 2.0 e versioni successive.
Seleziona il file specificato dal parametro SelectedFile.
SelectedFile - Microsoft.PowerShell.Host.ISE.ISEFile Il file ISEFile da selezionare.
# Selects the specified file.
$firstfile = $psISE.CurrentPowerShellTab.Files[0]
$psISE.CurrentPowerShellTab.Files.SetSelectedFile($firstfile)