adsense


Thursday, 12 November 2015

ADVANCE VB SCRIPT DRIVES PAGE 106

COMPUTER LANGUAGES HTML,C,C++.JAVA,.NET AND MULTIMEDIA basics and programs click home button




ADVANCE VB SCRIPT DRIVES





Drives

 
Drives is a collection, which provides details of all the drives 
attached to the system, either physically or logically. It carries two properties: 

• Count Property 

 

• Item Property 

Example 
<!DOCTYPE html> 
<html> 
<body> 
<script language="vbscript" type="text/vbscript"> 
 
   Dim oFS, d, dc, s, n 
   Set oFS = CreateObject("Scripting.FileSystemObject") 
   Set dc = oFS.Drives 
   For Each d in dc 
      n = "" 
      s = s & d.DriveLetter & " - "  
      If d.DriveType = 3 Then 
         n = d.ShareName 
      ElseIf d.IsReady Then 
         n = d.VolumeName 
      Else 
         n = "Drive not available" 
      End If 
      s = s & n & "::" 
   Next 
    
   document.write s 
   document.write dc.count 
  
</script> 
</body> 
</html> 
If the above script is saved as HTML and executed in IE, 
we would get the following output in the console. 
C- Win 7::D-Personal ::E-Common::F-Songs:: 
4 


No comments: