Drive.DriveLetter
JScript3.0+Syntax
driveobject.DriveLetter
Description
The DriveLetter property of the Drive object contains the drive letter of the local drive or a shared network.
Example
Listing 9.27 retrieves the drive letter for the specified drive.
Listing 9.27 Display the Drive Letter
<script language="JScript"> <!-- Hide //Create a string to hold the drive path var drivePath = "C:"; //Create a file system object var fileSysObj = new ActiveXObject("Scripting.FileSystemObject"); //Create a Drive object for drive C var drive = fileSysObj.GetDrive(fileSysObj.GetDriveName(drivePath)); //Display the drive letter document.write("The driver letter for ",drivePath," is ",drive.DriveLetter); //Hide End --> </script> |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.