Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Apr 8, 1999

Read the Serial Number of a Disk

The new Microsoft Scripting Runtime library includes a FileSystemObject hierarchy containing several objects that let you obtain information about your drives, folders, and files. For example, you can retrieve the serial number of a disk using this code:
 
' Get the serial number of drive C:
Dim fso As New Scripting.FileSystemObject
Dim dr As Scripting.Drive
' Get a reference to the Drive object
Set dr = fso.GetDrive("C")
Print Hex$(dr.SerialNumber)
You can also easily check whether a drive has enough free space on it, using the Drive object's FreeSpace property:
 
Print "Drive C: has " & dr.FreeSpace " bytes free."
For more information, look on VB's Help file under "Dictionary" and "FileSystemObject."
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date