RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

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



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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.



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