Javascript FSO Drive Object DriveLetter property

Updated on 30 Mar 2012,
Published on 26 Sep 2008

In Javascript, Drive object returned by the GetDrive method of FileSystemObject (FSO) provides the access to DriveLetter property. The DriveLetter property of Drive object returns the uppercase Letter that represents the specified drive. You can identify the drive of the client’s PC through this DriveLetter property of Drive object. DriveLetter property could not retrieve the drive letter from the shared network name of any drive. GetDrive method accepts the English alphabet representing drives of computer system for example A, C, D or E according to the number of drives found on client’s PC whose DriveLetter you want to retrieve. 

Example of Javascript Drive Object DriveLetter property

<script type="text/javascript">
    // initialize ActiveXObject and create an object of Scripting.FileSystemObject.
    var fso = new ActiveXObject("Scripting.FileSystemObject");

    // Drive object reference set to driveObj variable
    var driveObj = fso.GetDrive("C");

    // returns Drive Letter representing the specified drvie
    document.write("<b>Drive Letter :</b> " + driveObj.DriveLetter); 

    // Output: 
    // Drive Letter : C
</script>

Continue to next tutorial: Javascript FSO Drive Object DriveType property to learn how to get the type of specified drive.

0 Responses to "Javascript FSO Drive Object DriveLetter property"
Leave a Comment
* required
* required
* will not be published
* optional
* hint: http://www.example.com
  • Subscribe via Email
  • HIRE EzineASP.Net Developers