Javascript VolumeName property of FileSystemObject (FSO), Drive object returned by GetDrive method returns the volume label of the specified drive or network shared drive. VolumeName property of Drive object retrieves the name of the drive provided by the user to the specified drive. Javascript VolumName property returns the disk label only if the user has set its name, otherwise it does not return any value. This property is also same as the Window’s command prompt “VOL” command that returns the serial number as well as volume label 

Example of Javascript Drive Object VolumeName 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 the volume label of the specified drive
    document.write("<b>Disk Label :</b> " + driveObj.VolumeName);

    document.write("<br />");

    document.write("<b>Disk Label :</b> " 
                    + fso.GetDrive("\\\\my-PC\\d").VolumeName);

    // Output: 
    // Disk Label : Windows 
    // Disk Label : Shared Drive
</script>

Continue to next tutorial: Javascript FSO Attributes Property to learn how to get the attributes information about the specified file or folder.

Recent JavaScript Tutorials

Javascript FSO ShortPath property

Javascript FileSystemObject (FSO) provides a ShortPath property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Path Property

Javascript FileSystemObject (FSO) provides the Path property that can be accessed through the file object or folder object returned by the GetFile or GelFolder method

Javascript FSO Type property

Javascript FileSystemObject (FSO) provides a Type property that can be accessed through file object or folder object returned by the GetFile or GetFolder method

Javascript FSO ShortName property

Javascript FileSystemObject (FSO) provides a ShortName property that can be accessed using the folder object or file object returned by the GetFolder or GetFile method.

Javascript FSO Name Property

Javascript FileSystemObject (FSO) provides a Name property that can be accessed using file object or folder object.