'v7.2***************************************************** ' File: disk0-test.vbs ' Autor: dieseyer@gmx.de ' dieseyer.de ' ' Zeigt Infos zu Laufwerk C:, die von DISKPART.EXE stammen. '********************************************************* Option Explicit ' Siehe http://dieseyer.de/dse-wsh-lernen.html#OptionExpl ' Dim fso : Set fso = WScript.CreateObject("Scripting.FileSystemObject") Dim WSHShell : Set WSHShell = WScript.CreateObject("WScript.Shell") Dim Txt, Tst, i Dim oExec Const HDD = "DISK 0" ' Größe der HDD ermitteln '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set oExec = WSHShell.Exec( "diskpart.exe" ) Do While Not oExec.StdOut.AtEndOfStream WScript.Sleep 15 Txt = oExec.StdOut.ReadLine Tst = Tst & Txt & vbCRLF ' MsgBox Txt & vbCRLF & vbCRLF & Tst, , "0029 :: " ' zeigt in der ersten Zeile die letzte Ausgabe If InStr( UCase( Txt ), "COMPUTER" ) > 0 Then oExec.StdIn.Write "list disk" & vbCRLF If InStr( UCase( Txt ), "GB " ) > 0 Then oExec.StdIn.Write "exit" & vbCRLF : Exit Do WScript.Sleep 15 Loop oExec.Terminate Set oExec = nothing MsgBox Tst, , "0039 :: " ' Anwendung ist beendet Tst = Split(Txt, " ", -1) For i = LBound( Tst ) to UBound( Tst ) If InStr( Tst(i), "GB" ) Then Txt = Tst(i-1) ' Größe der HDD in GB Next Txt = "Laufwerk C: ist " & Txt & " GB groß." WSHShell.Popup Txt ,30 , "0048 :: " & WScript.ScriptName, 4096 + 256 WScript.Quit