ISEFile 개체는 Windows PowerShell ISE(통합 스크립팅 환경)의 파일을 나타내며 Microsoft.PowerShell.Host.ISE.ISEFile 클래스의 인스턴스입니다. 이 항목에서는 이 개체의 멤버 메서드와 멤버 속성을 나열합니다. Powershell 탭에 있는 $psISE.CurrentFile 및 Files 컬렉션의 파일은 Microsoft.PowerShell.Host.ISE.ISEFile 클래스의 인스턴스입니다.

메서드

Save(System.Text.Encoding saveEncoding)

파일을 디스크에 저장합니다.

saveEncoding
저장된 파일에 사용할 인코딩입니다.

예외
  • System.IO.IOException: 파일을 저장할 수 없습니다.

# Save the file as ASCII.
$myfile=$psIse.CurrentFile
$myfile.Save( [System.Text.Encoding]::ASCII)

# Gets the current encoding.
$myfile=$psIse.CurrentFile
$myfile.Encoding

Save()

파일을 저장합니다.

예외
  • System.IO.IOException: 파일을 저장할 수 없습니다.

# Explicitly save the file. 
$psIse.CurrentFile.save()

SaveAs(string fileName)

파일을 지정한 fileName으로 저장합니다.

fileName
파일을 저장할 이름입니다. 이 메서드의 기본 인코딩은 UTF-16입니다.

예외
  • System.ArgumentNullException: fileName이 null입니다.

  • System.ArgumentException: fileName이 비어 있습니다.

  • System.IO.IOException: 파일을 저장할 수 없습니다.

# Explicitly save the file. 
$fullpath = "c:\temp\newname.txt"
$myfile=$psIse.CurrentFile
$myfile.SaveAs($fullPath)

SaveAs(string fileName, System.Text.Encoding saveEncoding)

지정한 fileName을 사용하여 파일을 지정한 인코딩으로 저장합니다.

fileName:
파일을 저장할 이름입니다. 파일의 전체 경로 이름을 지정할 수 있습니다.

saveEncoding
파일을 저장할 인코딩입니다.

예외
  • System.ArgumentNullException: fileName이 null입니다.

  • System.ArgumentException: fileName이 비어 있습니다.

  • System.IO.IOException: 파일을 저장할 수 없습니다.

# Explicitly save the file as UTF8.
$fullpath = "c:\temp\newname.txt"
$myfile=$psIse.CurrentFile
$myfile.SaveAs($fullPath, [System.Text.Encoding]::UTF8)
# Gets the current encoding.
$myfile=$psIse.CurrentFile
$myfile.Encoding

속성

DisplayName

이 파일의 표시 이름이 포함된 문자열을 가져오는 읽기 전용 속성입니다.

# Shows the display name of the file.
$psIse.CurrentFile.DisplayName

Editor

지정한 파일에 사용되는 편집기를 가져오는 읽기 전용 속성입니다.

# Gets the editor and the text.
$myfile=$psIse.CurrentFile
$myfile.Editor.Text 

Encoding

원본 파일의 인코딩을 가져오는 읽기 전용 속성이며, System.Text.Encoding 개체입니다.

# Shows the encoding for the file. 
$myfile=$psIse.CurrentFile
$myfile.Encoding

FullPath

열려 있는 파일의 전체 경로를 지정하는 문자열을 가져오는 읽기 전용 속성입니다.

# Shows the full path for the file. 
$myfile=$psIse.CurrentFile
$myfile.FullPath

IsSaved

파일을 마지막으로 수정한 이후 저장되었으면 true를 반환하는 읽기 전용 부울 속성입니다.

# Determines whether the file has been saved since it was last modified.
$myfile=$psIse.CurrentFile
$myfile.IsSaved

IsUntitled

파일의 제목이 지정된 적이 없는 경우 true를 반환하는 읽기 전용 속성입니다.

# Determines whether the file has never been given a title.
$psISE.CurrentFile.IsUntitled
$psISE.CurrentFile.SaveAs("temp.txt")
$psISE.CurrentFile.IsUntitled

참고 항목




목차