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

'*** v5.A*** www.dieseyer.de *******************************
'
' Datei: laufwerk-c.vbs
' Autor: dieseyer@gmx.de
' Auf: www.dieseyer.de
'
' Zeigt Infos zu Laufwerk C:.
'
'************************************************************

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

Dim Txt

Txt = FestplattenTest( "C:" ) ' mit Function-Aufruf
Txt = "Auf Laufwerk C: sind " & Txt & "."

MsgBox Txt, , "16 :: " & WScript.ScriptName

'*** v5.A*** www.dieseyer.de *******************************
Function FestplattenTest( Lw )
'************************************************************
Dim WshShell, fso, FileOut, DriveList, i, Text1, Text3

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


Lw = Replace( Lw, "\", "" )
Lw = Replace( Lw, ":", "" )

For Each i in DriveList
If i.DriveLetter = Lw AND i.IsReady Then

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

FestplattenTest = Text1
End If

Next
' MsgBox FestplattenTest, , "41 :: " & WScript.ScriptName

End Function ' FestplattenTest( Lw )


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