http://dieseyer.de • all rights reserved • © 2011 v11.4

'*** v4.A *** www.dieseyer.de *******************************
'
' Datei: laufwerkliste2.vbs
' Autor: dieseyer@gmx.de
' Auf: www.dieseyer.de
'
' Listet alle lokalen Laufwerke auf
'
'************************************************************

Option Explicit ' Siehe http://dieseyer.de/dse-wsh-lernen.html#OptionExpl

MsgBox LwListe(), , WScript.ScriptName

WScript.Quit

'*** v4.A *** www.dieseyer.de *******************************
Function LwListe()
'************************************************************

Dim WSHNet : Set WSHNet = WScript.CreateObject("WScript.Network")
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim DriveList : Set DriveList = fso.Drives
Dim i
Dim Text1, Text3

For Each i in DriveList
if 0 = i.DriveType Then Text1 = "??? " & vbTab & i.DriveLetter & ": " & vbTab
if 1 = i.DriveType Then Text1 = "Disk-Lw." & vbTab & i.DriveLetter & ": " & vbTab
if 2 = i.DriveType Then Text1 = "Festpl. " & vbTab & i.DriveLetter & ": " & vbTab
if 3 = i.DriveType Then Text1 = "Netz-Lw." & vbTab & i.DriveLetter & ": " & vbTab
if 4 = i.DriveType Then Text1 = "CD-Lw. " & vbTab & i.DriveLetter & ": " & vbTab
if 5 = i.DriveType Then Text1 = "RAM-Lw. " & vbTab & i.DriveLetter & ": " & vbTab
If i.IsReady Then

Text3 = ""
Text3 = FormatNumber(i.FreeSpace/1024/1024, 1) & "MB" & vbTab & "von" & vbTab
if Text3 <> "" then Text1 = Text1 & Text3
if Text3 = "" then Text1 = Text1 & "?-?-?MB" & vbTab & "von" & vbTab
Text3 = ""
Text3 = FormatNumber(i.TotalSize/1024/1024, 1) & "MB" & vbTab & " frei"
if Text3 <> "" then Text1 = Text1 & Text3
if Text3 = "" then Text1 = Text1 & "?-?-?MB" & vbTab & " frei"

End If

LwListe = LwListe & Text1 & vbCRLF
Next

End Function ' LwListe()

http://dieseyer.de • all rights reserved • © 2011 v11.4