Root CD Drive
Hi,
I was just asked for help with this, so I'm interpreting the request. an associate of mine is looking for an "environment variable" in the "system variables" on a machine that he can set to look for the first CD drive. I've been googling this without success for the past hour. Anyone know what it would be? I'm guessing something like %ROOT_CDROM% or something to that .
Any help would be greatly appreciated.
Thanks!
I was just asked for help with this, so I'm interpreting the request. an associate of mine is looking for an "environment variable" in the "system variables" on a machine that he can set to look for the first CD drive. I've been googling this without success for the past hour. Anyone know what it would be? I'm guessing something like %ROOT_CDROM% or something to that .
Any help would be greatly appreciated.
Thanks!
0 Comments
[ + ] Show comments
Answers (10)
Please log in to answer
Posted by:
Robo Scripter
20 years ago
Try This;
***************** FindCD.vbs *******************************
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives
For Each objDrive In colDrives
If objDrive.DriveType = 4 then
CDROM = objDrive.DriveLetter & Chr(58) & Chr(92) '":\"
WScript.Echo cdrom
End If
Next
******************* End Code ********************************
Regards,
***************** FindCD.vbs *******************************
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives
For Each objDrive In colDrives
If objDrive.DriveType = 4 then
CDROM = objDrive.DriveLetter & Chr(58) & Chr(92) '":\"
WScript.Echo cdrom
End If
Next
******************* End Code ********************************
Regards,
Posted by:
daveinmn
20 years ago
Posted by:
Robo Scripter
20 years ago
There is not one to my knownedge, else I would think that the vbscript would just call the system environment object via WIN32_Environment in WMI.
If you were to use WMI then you could simply use the WIN32_CDROMDrive object.
But if your doing a straight DOS read then I don't think there is a way to get this information.
Of course one could modify the FindCD VBS to create a %CDROM% system environment varible, if that is what the requester is after.
Regards,
If you were to use WMI then you could simply use the WIN32_CDROMDrive object.
But if your doing a straight DOS read then I don't think there is a way to get this information.
Of course one could modify the FindCD VBS to create a %CDROM% system environment varible, if that is what the requester is after.
Regards,
Posted by:
daveinmn
20 years ago
OK here's my response from the requester... does this help?
Not an environmental variable, some type of compiler variable that loads a value based on a registry value. I know it's in there and I can get it with Installmaster, just don't know how to do it in a msi.
Thanks again for all the help. I can package, but I am no software developer.
Not an environmental variable, some type of compiler variable that loads a value based on a registry value. I know it's in there and I can get it with Installmaster, just don't know how to do it in a msi.
Thanks again for all the help. I can package, but I am no software developer.
Posted by:
Robo Scripter
20 years ago
Posted by:
daveinmn
20 years ago
Posted by:
Trent_R
19 years ago
Hi!
I need to set an INI file value to a number representing the first CD-Drive's letter. E: would be 4, F: would be 5, G: would be 6 and so on. So i modified your VBS to look like this:
It runs through all drives adding the driveletters to CDROM. The ASC function only looks at the first character in a string so it automatically returns the number of the first CD drive even if more than one drive is present. The 65 is subtracted to get a number according to the scheme described above.
My question is: How do I get the value of CDROM into the INI file or into a property so I can use this to set the INI file value?
I've tried using
Thanks in advance
Trent
I need to set an INI file value to a number representing the first CD-Drive's letter. E: would be 4, F: would be 5, G: would be 6 and so on. So i modified your VBS to look like this:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives
For Each objDrive In colDrives
If objDrive.DriveType = 4 then
CDROM = CDROM & objDrive.DriveLetter
End If
Next
CDROM = ASC(CDROM) - 65
It runs through all drives adding the driveletters to CDROM. The ASC function only looks at the first character in a string so it automatically returns the number of the first CD drive even if more than one drive is present. The 65 is subtracted to get a number according to the scheme described above.
My question is: How do I get the value of CDROM into the INI file or into a property so I can use this to set the INI file value?
I've tried using
session.property("FirstCDRom") = CDROM
(of course I've created the property first) but this way I get an error 1720.Thanks in advance
Trent
Posted by:
aogilmor
19 years ago
Posted by:
Trent_R
19 years ago
Well, getting the value from the property into the INI wasn't the hard part. It was more like getting the value from the VBScript variable into the property. I finally figured it out myself. It's the position of the custom action in the sequence that either causes those installer errors (I had errors 1720 and 2762) or makes it work.
As it seems it only allows setting the property after CostFinalize and before InstallInitialize (maybe there are other positions as well).
Still I'd like to thank you for your efforts and the URL you posted. Every source of information is valuable [:D]
As it seems it only allows setting the property after CostFinalize and before InstallInitialize (maybe there are other positions as well).
Still I'd like to thank you for your efforts and the URL you posted. Every source of information is valuable [:D]
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.