vbscript drive letter script :)

luked's Avatar, Join Date: May 2008
Newbie Member
hi all.
could sumone plz help me out with a script that,
a, ask for a drive letter
b, displays the type of drive
c, displayes its state (rdy or not rdy)
d, displays its serial no.
e, if no drive letter is entered or u hit esc or cancel the script should exit , saying no drive letter was entered.


i have looked everywhere for a script like this but havent found any
many thx in advance
0
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
Here's you script

Code: vb
' First creat an FSO object
Set FSO = CreateObject("Scripting.FileSystemObject")

' Drive specifications
Dim Drv, DrvType, DrvName, DrvReady

' Get and format the drive name
InputBox("Please enter drive letter :", DrvName)
If Len(DrvName) > 1 Then DrvName = Left(DrvName,1)

' Check if user clicks "Cancel"
If DrvName = "" Then End

' Continue :)
Drv = FSO.GetDrive(DrvName)

Select Case Drv.DriveType
            Case 0: DrvType = "Unknown"
            Case 1: DrvType = "Removable"
            Case 2: DrvType = "Fixed"
            Case 3: DrvType = "Network"
            Case 4: DrvType = "CD-ROM"
            Case 5: DrvType = "RAM Disk"
End Select

If Drv.IsReady Then DrvReady = "Ready" Else DrvReady = "Not Ready"

MsgBox "Drive = " & DrvName & VbCrLf & "Drive Type = " & DrvType & VbCrLf &_
"Drive State = " & DrvReady & VbCrLf & "Volume Name = " & Drv.VolumeName

Last edited by SaswatPadhi; 7May2009 at 20:44.. Reason: Wrote Left$ instead of Left :p