?
Solved

environmet variable

Posted on 2004-03-24
7
Medium Priority
?
187 Views
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?

Mario
0
Comment
Question by:Mario_castro
[X]
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
7 Comments
 
LVL 16

Expert Comment

by:JammyPak
ID: 10668987
set CDROM=d:
0
 

Author Comment

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

Expert Comment

by:JammyPak
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.
0
 
LVL 7

Accepted Solution

by:
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
Next
Set Drives = Nothing
Set FileSystemObject = Nothing

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

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

hth,
4auHuk
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

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…
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

762 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