Javascript ShareName property of FileSystemObject (FSO), Drive object returned by the GetDrive method returns the (Universal Name Convention) UNC shared name of the specified network shared drive. ShareName property of drive object just returns a string containing computer name and shared drive name for example “\\my-computer\E”. ShareName property does not work with simple drive letter specification passed to the GetDrive Method. It requires UNC network path to the shared drive.
Example of Javascript Drive Object ShareName 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 shared name of the specified network shared path
document.write("<b>Shared (Network) Name :</b> "
+ fso.GetDrive("\\\\my-PC\\D").ShareName);
// Output:
// Shared (Network) Name : \\my-PC\d
</script>
Continue to next tutorial: Javascript FSO Drive Object TotalSize property to learn how to get the total space of the specified drive.