Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


environmet variable

Posted on 2004-03-24
Medium Priority
Last Modified: 2010-04-13
hello experts.

i need crate a envrironmet varible that containt the cdrom drive lleter asigned(D: E:), this is because i make a auto instalaer program.

any ideas?

Question by:Mario_castro
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 16

Expert Comment

ID: 10668987
set CDROM=d:

Author Comment

ID: 10669017
If the cdrom use other letter??????
LVL 16

Expert Comment

ID: 10669324
then use the other letter! (haha)

sorry, I think I misunderstood what you were trying to do - I thought you wanted to set a variable to a known value, not dynamically set it.

Accepted Solution

4auHuk earned 200 total points
ID: 10672216
Hi Mario_castro,
Don't know if you can use VBscript in your case but anyway. Following script will assign CDDRIVE variable first CD-Drive's letter.

'----start setcdvar.vbs----
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set Drives = FileSystemObject.Drives
For Each DiskDrive in Drives
    DriveLetter = DiskDrive.DriveLetter
    If DiskDrive.DriveType = 4 Then
        Set WSHShell = WScript.CreateObject("WScript.Shell")
        WSHShell.Environment.Item("CDDRIVE") = Driveletter & ":\"
        Exit For
    End If
Set Drives = Nothing
Set FileSystemObject = Nothing

'Optional - result output.
WScript.Echo "CDDRIVE = " & WSHShell.Environment.Item("CDDRIVE")

Set WSHShell = Nothing
'----end setcdvar.vbs----


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Geo-targeting is the practice of distributing content based on a person’s location, as best as you can determine it. Let’s look at some ways you could successfully use this tactic. The following tips and case studies could lead to meaningful results.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question