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

'*** v2.9*** www.dieseyer.de *******************************
'
' Datei: laufwerkliste.vbs
' Autor: dieseyer@gmx.de
' Auf: www.dieseyer.de
'
' Listet alle lokalen Laufwerke auf & erstellt Log-Datei.
'
'************************************************************

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

Dim WshShell, fso, FileOut, DriveList, i, Text1, Text2, Text3

Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set DriveList = fso.Drives

' Protokoll in Datei schreiben
Set FileOut = fso.OpenTextFile(WScript.ScriptName & ".log", 8, true) ' Datei zum Schreiben öffnen (notfals anlegen)
fileOut.WriteLine(vbCRLF & now() & " Protokoll von " & WScript.ScriptName & ": ")

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

fileOut.WriteLine(Text1)
Text2 = Text2 & Text1 & vbCRLF
Next
FileOut.Close
Set FileOut = Nothing

MsgBox Text2, , WScript.ScriptName

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