ISEFileCollection 객체는 ISEFile 객체들의 집합입니다. 예를 들어 컬렉션이 있습니다 $psISE.CurrentPowerShellTab.Files .
메서드
Add( [FullPath] )
Windows PowerShell ISE 2.0 이후 버전에서 지원됩니다.
새로운 제목 없는 파일을 생성하고 반환하여 컬렉션에 추가합니다. 새로 생성된 파일의 IsUntitled 속성은 $true입니다.
- [FullPath] - 선택적 문자열 - 파일의 완전히 지정된 경로. FullPath 매개변수와 상대 경로를 포함하거나, 전체 경로 대신 파일 이름을 사용하면 예외가 생성됩니다.
# 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] )
Windows PowerShell ISE 2.0 이후 버전에서 지원됩니다.
현재 PowerShell 탭에서 지정된 파일을 제거합니다.
파일 - 문자열 컬렉션에서 제거하려는 ISEFile 파일입니다. 파일이 저장되지 않았다면, 이 메서드는 예외를 던집니다. Force switch 매개변수를 사용해 저장되지 않은 파일을 강제로 삭제하세요.
[강제] - 선택적 불리언: 로 설정 $true하면 마지막 사용 후 저장되지 않은 파일도 삭제 권한을 부여합니다. 기본값은 $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 )
Windows PowerShell ISE 2.0 이후 버전에서 지원됩니다.
SelectedFile 매개변수로 지정된 파일을 선택합니다.
SelectedFile - Microsoft.PowerShell.Host.ISE.ISEFile 선택하려는 ISEFile 파일입니다.
# Selects the specified file.
$firstfile = $psISE.CurrentPowerShellTab.Files[0]
$psISE.CurrentPowerShellTab.Files.SetSelectedFile($firstfile)