(windows scripting) Could use some help!
2013-09-21, 08:40 PM,
#1
Hello all.

So basicly for school i needed to code a program wich shows the available space for every partition i have made in my laptop.
But when i run it all the partitions comes seperatley.

This is what i get:

[Image: ddZLSlz.png]

Current code:

Code:
Const CONVERSION_FACTOR = 1048576
Computer = "."
Set objWMIService = GetObject("winmgmts://" & Computer)
Set colLogischeSchijf = objWMIService.InstancesOf ("Win32_LogicalDisk")
For Each objLogicalDisk in ColLogischeSchijf
    FreeMegaBytes = objLogicalDisk.Freespace / CONVERSION_FACTOR
    Wscript.Echo objLogicalDisk.DeviceID & " " & Int(FreeMegaBytes)
    Next

When i click on OK the first box dissapears and then the D partition comes up.

How can i get these to be displayed on one box?

Any help would be much appreciated.

Regards,
DutchPride

Any questions related to CPA belong here.
Before posting, make sure you are in the correct section.

I am temporarily absent due to family circumstances.

Reply
2013-09-22, 10:38 AM, (This post was last modified: 2013-09-22, 10:38 AM by Zack.)
#2
Code:
Const CONVERSION_FACTOR = 1048576
Computer = "."
Output = ""
Set objWMIService = GetObject("winmgmts://" & Computer)
Set colLogischeSchijf = objWMIService.InstancesOf ("Win32_LogicalDisk")
For Each objLogicalDisk in ColLogischeSchijf
    FreeMegaBytes = objLogicalDisk.Freespace / CONVERSION_FACTOR
    Output = Output + objLogicalDisk.DeviceID & " " & Int(FreeMegaBytes) & vbCrLf
Next
Wscript.Echo Output

PM ME FOR A VIDEO FLAGGER.
Reply
2013-09-22, 03:48 PM,
#3
(2013-09-22, 10:38 AM)Zack Wrote:
Code:
Const CONVERSION_FACTOR = 1048576
Computer = "."
Output = ""
Set objWMIService = GetObject("winmgmts://" & Computer)
Set colLogischeSchijf = objWMIService.InstancesOf ("Win32_LogicalDisk")
For Each objLogicalDisk in ColLogischeSchijf
    FreeMegaBytes = objLogicalDisk.Freespace / CONVERSION_FACTOR
    Output = Output + objLogicalDisk.DeviceID & " " & Int(FreeMegaBytes) & vbCrLf
Next
Wscript.Echo Output

Thanks allot man, You saved me allot of headache!

Any questions related to CPA belong here.
Before posting, make sure you are in the correct section.

I am temporarily absent due to family circumstances.

Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Visual Basic Installer - Windows Detect Danger szikaka245 9 1,176 2014-08-08, 03:35 AM
Last Post: DutchPride
  Java windows style GUI 1MMigos 6 685 2014-08-03, 01:58 AM
Last Post: 1MMigos
  [LF] Install Linux and 2x Windows Server on my dedicated server tbonemaker 4 523 2014-07-30, 02:58 PM
Last Post: justlike
  How To Fix The Flicker On Photoshop(Windows 7 and 8) Amped- 6 868 2014-01-29, 05:35 AM
Last Post: Amped-
  wish scripting language should i learn? lanadekat 22 1,412 2014-01-11, 12:47 AM
Last Post: lanadekat





About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top