ISEFileCollection 개체
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 파일 문자열입니다. 파일이 저장되지 않은 경우 이 메서드는 예외를 throw합니다. Force 스위치 매개 변수를 사용하여 저장되지 않은 파일을 강제로 제거합니다.
[Force] - 선택적 부울이 $true
설정된 경우 마지막으로 사용한 후에 저장되지 않은 경우에도 파일을 제거할 수 있는 권한을 부여합니다. 기본값은 $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 )
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)
참고 항목
PowerShell