Jump to content

Recommended Posts

Posted (edited)

Hello

I need to check destination drive before installing some appz.

The G: drive must be present. How can you do that ?

Btw i want ot check if at least 500 MB of drive is available.

Is it possible ?

thx

Edited by hfrfc

Posted

At which time do you want to check for the free space? In a batchfile you could use the following line to put the free space on the partition, where your %PROGRAMFILES%-folder is located:

For /f "usebackq tokens=3" %%i IN (`dir %PROGRAMFILES%`) DO set free=%%i

To check, if the drive g: is present, you can use the following line

For /f "usebackq tokens=1" %%j IN (`fsutil fsinfo volumeinfo z:`) DO set error=%%j

After using this, and the drive is not present, the variable %error% has the value "Error:" (at least, when you are using an englisch windows

  • 1 month later...
Posted

I use this during my install to verify that the D Partition exists. HTH

Dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
Dim oshell
Set oshell = CreateObject("WScript.Shell")

'case 0: drtype = "Unknown"
'case 1: drtype = "Removable"
'case 2: drtype = "Fixed"
'case 3: drtype = "Network"
'case 4: drtype = "CD-ROM"
'case 5: drtype = "RAM Disk"

If filesys.DriveExists("d") Then
Set drv = filesys.GetDrive("d")
Do While drv.DriveType <> 2
msgBox "It appears that there is no D partition!", 0, "Critical Error"
msgBox "The disk management console will now be opened. Please create a D partition and change the CD ROM drive letter to E", 0, "D Drive Neccessary"
oshell.run "diskmgmt.msc" ,0, True
Wscript.Sleep 20000
Loop
Result = oshell.Popup("D Partition ready", 3, "App Install", 0)
End If
Set filesys = Nothing
Set oshell = Nothing

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...