Scripting Runtime Library(FileSystemObject)

지정한 파일, 폴더, 또는 드라이브의 경로를 반환한다.

Script[sVal=]object.Path
HTML없음
인수
objec : (개체)

필수적인 요소이며, object는 항상 File, Folder, 또는 Drive 개체이다.

sVal : (속성 문자열)
Path 속성값은 개체의 경로를 나타내는 문자열이다.

이 속성은 읽기전용이며 디폴트값은 없다.

특기

드라이브 문자에 루트 드라이브는 포함되지 않는다.
예를 들어, C 드라이브의 경로는 C:\가 아니라 C:이다.


property
Path 속성
Path</b> 속성이전페이지로페이지 맨위로페이지 맨아래로

Path 속성 예제

결과 표시창
JScript Path 속성 예제
<SCRIPT language=JScript>
function PathTest(filePath){
  var fso,driveObj,fileObj,str;
  fso=new ActiveXObject('Scripting.FileSystemObject');
  if (!fso.FileExists(filePath)){ // 오류 방지를 위하여 화일이 없으면 생성한다.
    fileObj=fso.OpenTextFile(filePath,2,true);
    fileObj.Write(filePath+' 화일');
    fileObj.Close();
  }
  fileObj=fso.GetFile(filePath);
  str='File 경로="'+fileObj.Path.toUpperCase()+'"<BR>';
  folderObj=fileObj.ParentFolder;
  str+='ParentFolder 경로="'+folderObj.Path.toUpperCase()+'"<BR>';
  return(str);
}
</SCRIPT>

<DIV id=showjs class=show alt="결과">결과 표시창</DIV>
<DIV class=show
  onClick="showjs.innerHTML=PathTest('C:\\JsTest\\expSample.txt')">
 <SPAN class=ie>JScript</SPAN> <SPAN class=property>Path</SPAN> 속성 예제</DIV>

VBScript로 반복

결과 표시창
VBScript Path 속성 예제
<SCRIPT language=VBScript>
Function PathTestvb(filePath)
  Dim fso,driveObj,fileObj,str
  Set fso=CreateObject("Scripting.FileSystemObject")
  If Not fso.FileExists(filePath) Then ' 오류 방지를 위하여 원본 화일이 없으면 생성한다.
    Set fileObj=fso.OpenTextFile(filePath,2,true)
    fileObj.Write filePath&" 화일"
    fileObj.Close
  End If
  Set fileObj=fso.GetFile(filePath)
  str="File 경로='"&UCase(fileObj.Path)&"'<BR>"
  Set folderObj=fileObj.ParentFolder
  str=str&"ParentFolder 경로='"&UCase(folderObj.Path)&"'<BR>"
  PathTestvb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="결과">결과 표시창</DIV>
<DIV class=show
  onClick="showvb.innerHTML=PathTestvb('C:\\JsTest\\expSample.txt')">
 <SPAN class=ie>VBScript</SPAN> <SPAN class=property>Path</SPAN> 속성 예제</DIV>

property
Path 속성
견본
이전페이지로페이지 맨위로
최종 수정:
05/12/2025 14:10:53
KoXo Homepage
All right reserved
비정상적인 방식으로 프레임없이 페이지에 접속하면 자주 오류가 발생됩니다.
오류가 나면 정상적 접속으로 시도해 보세요.
http://koxo.com/lang/js/property/Path_fso.html