Drive.SerialNumber

JScript3.0+Syntax

							driveobject.SerialNumber

Description

The SerialNumber property of the Drive object contains the decimal serial number that uniquely identifies the specified disk volume.

Example

Listing 9.34 displays the unique serial number of drive C.

Listing 9.34 Unique Serial Number of Drive C
 <script language="JScript"> <!-- Hide //Create a string to hold the drive pathvar 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 serial number associated with the drive document.write("Drive serial number is ",drive.SerialNumber); //Hide End ...

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.