Scripting Runtime Library(FileSystemObject)

ÁöÁ¤ÇÑ °æ·Î¿¡¼­ µå¶óÀ̺ê À̸§À» Æ÷ÇÔÇÏ´Â ¹®ÀÚ¿­À» ¹ÝȯÇÑ´Ù.

Àμö/ÆĶó¸ÞÅÍ
object
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, FileSystemObjectÀÇ À̸§ÀÌ´Ù.
drivePath
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, µå¶óÀ̺ê À̸§À» ¹ÝȯÇÒ ±¸¼º ¿ä¼ÒÀÇ °æ·ÎÀÌ´Ù.
¹Ýȯ°ª

¹Ýȯ°ª sDriveÀº ÁöÁ¤µÈ °æ·ÎÀÇ µå¶óÀ̺ê À̸§À» Æ÷ÇÔÇÏ´Â ¹®ÀÚ¿­ÀÌ´Ù.

¼³¸í

ÁöÁ¤ÇÑ °æ·Î¿¡¼­ µå¶óÀ̺ê À̸§À» Æ÷ÇÔÇÏ´Â ¹®ÀÚ¿­À» ¹ÝȯÇÑ´Ù.

µå¶óÀ̺긦 È®ÀÎÇÒ ¼ö ¾øÀ¸¸é GetDriveName ¸Þ¼­µå´Â ºó ¹®ÀÚ¿­("")À» ¹ÝȯÇÑ´Ù.

Âü°í: GetDriveName ¸Þ¼­µå´Â Á¦°øµÈ drivePath ¹®ÀÚ¿­¿¡¸¸ »ç¿ëÇÑ´Ù.
°æ·Î¸¦ °áÁ¤ÇÏÁöµµ ¾Ê°í ÁöÁ¤ÇÑ °æ·Î°¡ ÀÖ´ÂÁöµµ °Ë»çÇÏÁö ¾Ê´Â´Ù.

GetDriveName ¸Þ¼­µå ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript 'C:\' GetDriveName ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=JScript>
function GetDriveNameTest(drivePath){
  var fso;
  var str='<TABLE width=100% border=1>';
  str+='<TR><TH>Name</TH><TH>Letter</TH><TH>³»¿ª</TH><TH>°æ·Î</TH></TR>';
  fso=new ActiveXObject('Scripting.FileSystemObject');
  enumObj=new Enumerator(fso.Drives);
  for (; !enumObj.atEnd(); enumObj.moveNext()){
    enum1=enumObj.item();
    str+='<TR><TD align=center>'+fso.GetDriveName(enum1)+'</TD>';
    str+='<TD align=center>'+enum1.DriveLetter+'</TD>';
    if (enum1.DriveType==3) driveObj=enum1.ShareName;
    else if (enum1.IsReady) driveObj=enum1.VolumeName;
    else driveObj='[µå¶óÀ̺갡 ÁغñµÇÁö ¾Ê¾Ò´Ù.]';
    str+='<TD>'+driveObj+'</TD>';
    str+='<TD align=center>'+enum1.Path+'</TD></TR>';
  }
  str+='</TABLE>';

  str+='fso.GetDrive(fso.GetDriveName(drivePath))='+fso.GetDrive(fso.GetDriveName(drivePath));
  return(str);
}
</SCRIPT>

<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showjs.innerHTML=GetDriveNameTest('C:\\')">
  <SPAN class=ie>JScript</SPAN> 'C:\' <SPAN class=method>GetDriveName</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>
°á°ú Ç¥½Ãâ
VBScript GetDriveName ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=VBScript>
Function GetDriveNameTestvb(drivePath)
  Dim fso,str
  str="<TABLE width=100% border=1>"
  str=str&"<TR><TH>Name</TH><TH>Letter</TH><TH>³»¿ª</TH><TH>°æ·Î</TH></TR>"
  Set fso=CreateObject("Scripting.FileSystemObject")

  Set drivesCol=fso.Drives
  For Each driveObj in drivesCol
    str=str&"<TR><TD align=center>"&fso.GetDriveName(driveObj)&"</TD>"
    str=str&"<TD align=center>"&driveObj.DriveLetter&"</TD>"
    driveVar=""
    If driveObj.DriveType=3 Then
      driveVar=driveObj.ShareName
    Elseif driveObj.IsReady Then
      driveVar=driveObj.VolumeName
    Else
      driveVar="[µå¶óÀ̺갡 ÁغñµÇÁö ¾Ê¾Ò´Ù.]"
    End If
    str=str&"<TD>"&driveVar&"</TD>"
    str=str&"<TD align=center>"&driveObj.Path&"</TD></TR>"
  Next
  str=str&"</TABLE>"

  str=str&"fso.GetDrive(fso.GetDriveName(drivePath))="&fso.GetDrive(fso.GetDriveName(drivePath))
  GetDriveNameTestvb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showvb.innerHTML=GetDriveNameTestvb('C:\\')">
  <SPAN class=ie>VBScript</SPAN> <SPAN class=method>GetDriveName</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>