File.Drive

JScript3.0+Syntax

							file.Drive

Description

The Drive property returns the drive letter of the drive on which the specified file or folder resides.

Example

Listing 9.56 shows how the Drive property is used to get the letter of the drive that contains the specified file.

Listing 9.56 Example of the Drive Property
 <html> <BODY> <script language="JScript"> <!-- Hide // function gets the drive letter on which the file resides and // then informs the user of the drive. function get() { var myObject, f, d; // Create an instance of the FileSystemObject myObject = new ActiveXObject("Scripting.FileSystemObject"); f = myObject.GetFile("c:\\test.txt"); d = f.drive; alert("The drive that test.txt resides is: " + d); } //--> </script> Get ...

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.