Nuta
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zalogować się lub zmienić katalogi.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Obiekt ISEFileCollection to kolekcja obiektów ISEFile . Przykładem jest kolekcja $psISE.CurrentPowerShellTab.Files .
Methods
Add( [FullPath] )
Obsługiwane w Windows PowerShell ISE 2.0 i nowszych.
Tworzy i zwraca nowy, niezatytułowany plik i dodaje go do kolekcji. Właściwość IsUntitled nowo utworzonego pliku to $true.
- [FullPath] - Opcjonalny ciąg - W pełni określona ścieżka pliku. Wyjątek jest generowany, jeśli uwzględnisz parametr FullPath i ścieżkę względną lub jeśli zamiast pełnej ścieżki używasz nazwy pliku.
# 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] )
Obsługiwane w Windows PowerShell ISE 2.0 i nowszych.
Usuwa określony plik z aktualnej zakładki PowerShell.
Plik - String Plik ISEFile, który chcesz usunąć z kolekcji. Jeśli plik nie został zapisany, ta metoda wyrzuca wyjątek. Użyj parametru Force switch, aby wymusić usunięcie niezapisanego pliku.
[Wymuszanie] - opcjonalny Boolean Jeśli ustawiono na $true, daje pozwolenie na usunięcie pliku, nawet jeśli nie został on zapisany po ostatnim użyciu. Wartość domyślna to $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 )
Obsługiwane w Windows PowerShell ISE 2.0 i nowszych.
Wybiera plik określony przez parametr SelectedFile .
SelectedFile - Microsoft.PowerShell.Host.ISE.ISEFile Plik ISEFile, który chcesz wybrać.
# Selects the specified file.
$firstfile = $psISE.CurrentPowerShellTab.Files[0]
$psISE.CurrentPowerShellTab.Files.SetSelectedFile($firstfile)