Scripting Runtime Library(FileSystemObject)
ÁöÁ¤ÇÑ °æ·Î¿¡¼ µå¶óÀ̺ê À̸§À» Æ÷ÇÔÇÏ´Â ¹®ÀÚ¿À» ¹ÝȯÇÑ´Ù.
¹Ýȯ°ª sDriveÀº ÁöÁ¤µÈ °æ·ÎÀÇ µå¶óÀ̺ê À̸§À» Æ÷ÇÔÇÏ´Â ¹®ÀÚ¿ÀÌ´Ù.
ÁöÁ¤ÇÑ °æ·Î¿¡¼ µå¶óÀ̺ê À̸§À» Æ÷ÇÔÇÏ´Â ¹®ÀÚ¿À» ¹ÝȯÇÑ´Ù.
µå¶óÀ̺긦 È®ÀÎÇÒ ¼ö ¾øÀ¸¸é GetDriveName ¸Þ¼µå´Â ºó ¹®ÀÚ¿("")À» ¹ÝȯÇÑ´Ù.
Âü°í: GetDriveName ¸Þ¼µå´Â Á¦°øµÈ drivePath ¹®ÀÚ¿¿¡¸¸ »ç¿ëÇÑ´Ù.
°æ·Î¸¦ °áÁ¤ÇÏÁöµµ ¾Ê°í ÁöÁ¤ÇÑ °æ·Î°¡ ÀÖ´ÂÁöµµ °Ë»çÇÏÁö ¾Ê´Â´Ù.
<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>
<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>