PC Review


Reply
Thread Tools Rate Thread

CD Drive letter variable

 
 
=?Utf-8?B?amRt?=
Guest
Posts: n/a
 
      17th Nov 2006
OK, it's been a long time since I've done something like this and I know it's
relatively easy. I want to multiple apps from a batch file on a CD:

<CDROMDrive>:\Folder1\app1.exe
<CDROMDrive>:\Folder2\app2.exe
<CDROMDrive>:\Folder3\app3.exe
<CDROMDrive>:\Folder4\app4.exe

What do I replace "<CDROMDrive>" with so that it will work no matter what
the CD drive letter is - i.e. one person's CD-ROM drive letter may be D,
while another's is G.

Thanks!
 
Reply With Quote
 
 
 
 
Claymore
Guest
Posts: n/a
 
      17th Nov 2006

Hi,

Don't know a variable for a CD-ROM drive, and what if the user has
multiple CD-ROM drives?

Would it work to put an autorun file on the CD and point it to the file
you want to start, or put your batch file on the CD and point the
autorun file to the batch file?

 
Reply With Quote
 
Jon
Guest
Posts: n/a
 
      17th Nov 2006
Probably easier to use VBScript than a batch file, as this script
illustrates (.vbs extension)

DisplayMessage = ""
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives
For Each d in dc
if d.DriveType = 4 then DisplayMessage = DisplayMessage & d.path & "
is a cdrom drive" & vbnewline
Next
msgbox DisplayMessage

--
Jon

Reliable sources are claiming that "jdm" <(E-Mail Removed)>
stated in message news:27197D8F-C1ED-49BD-90E4-(E-Mail Removed)...
> OK, it's been a long time since I've done something like this and I know
> it's
> relatively easy. I want to multiple apps from a batch file on a CD:
>
> <CDROMDrive>:\Folder1\app1.exe
> <CDROMDrive>:\Folder2\app2.exe
> <CDROMDrive>:\Folder3\app3.exe
> <CDROMDrive>:\Folder4\app4.exe
>
> What do I replace "<CDROMDrive>" with so that it will work no matter what
> the CD drive letter is - i.e. one person's CD-ROM drive letter may be D,
> while another's is G.
>
> Thanks!


 
Reply With Quote
 
=?Utf-8?B?amRt?=
Guest
Posts: n/a
 
      17th Nov 2006
It shouldn't matter if they have more than 1 CD-ROM drive, because it will
all run from 1 drive. I already have the autorun set up to launch the first
batch file. But that batch file will need to call (if the drive letter is D)
D:\folder1\app1.exe.

Obviously, I can't put D: in there, as someone else's drive letter may be
different. I know it can be done, as I've done it a long time ago. It's
something like
"%root%\folder1\app1.exe" but I just remember it...


"Claymore" wrote:

>
> Hi,
>
> Don't know a variable for a CD-ROM drive, and what if the user has
> multiple CD-ROM drives?
>
> Would it work to put an autorun file on the CD and point it to the file
> you want to start, or put your batch file on the CD and point the
> autorun file to the batch file?
>
>

 
Reply With Quote
 
Jon
Guest
Posts: n/a
 
      17th Nov 2006
ok, forget that post. Misread your request.

--
Jon


Reliable sources are claiming that "Jon"
<(E-Mail Removed)> stated in message
news:u$(E-Mail Removed)...
> Probably easier to use VBScript than a batch file, as this script
> illustrates (.vbs extension)
>
> DisplayMessage = ""
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set dc = fso.Drives
> For Each d in dc
> if d.DriveType = 4 then DisplayMessage = DisplayMessage & d.path & "
> is a cdrom drive" & vbnewline
> Next
> msgbox DisplayMessage
>
> --
> Jon
>
> Reliable sources are claiming that "jdm" <(E-Mail Removed)>
> stated in message
> news:27197D8F-C1ED-49BD-90E4-(E-Mail Removed)...
>> OK, it's been a long time since I've done something like this and I know
>> it's
>> relatively easy. I want to multiple apps from a batch file on a CD:
>>
>> <CDROMDrive>:\Folder1\app1.exe
>> <CDROMDrive>:\Folder2\app2.exe
>> <CDROMDrive>:\Folder3\app3.exe
>> <CDROMDrive>:\Folder4\app4.exe
>>
>> What do I replace "<CDROMDrive>" with so that it will work no matter what
>> the CD drive letter is - i.e. one person's CD-ROM drive letter may be D,
>> while another's is G.
>>
>> Thanks!

>


 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      17th Nov 2006

"jdm" <(E-Mail Removed)> wrote in message
news:27197D8F-C1ED-49BD-90E4-(E-Mail Removed)...
> OK, it's been a long time since I've done something like this and I know

it's
> relatively easy. I want to multiple apps from a batch file on a CD:
>
> <CDROMDrive>:\Folder1\app1.exe
> <CDROMDrive>:\Folder2\app2.exe
> <CDROMDrive>:\Folder3\app3.exe
> <CDROMDrive>:\Folder4\app4.exe
>
> What do I replace "<CDROMDrive>" with so that it will work no matter what
> the CD drive letter is - i.e. one person's CD-ROM drive letter may be D,
> while another's is G.
>
> Thanks!


Here is how you can detect your CD drive letter. The batch file
will show the highest letter found.

@echo off
set Label=CD-ROM
set drive=

for /F %%a in ('fsutil fsinfo drives ^| find "\" ^| find /i /v "Drives"') do
fsutil fsinfo DriveType %%a | find /i "%Label%" > nul &&
(set drive=%%a& goto Found)

echo %Label% not found
goto Exit

:Found
echo The %Label% is mounted on drive %drive%.

:Exit
echo Press the Space Bar to close this window.
pause > nul

Note that the line starting with "for" is very long. It ends with "Found)".


 
Reply With Quote
 
Jon
Guest
Posts: n/a
 
      17th Nov 2006

Would be easier to run the executables from subfolders or put the
executables in the same folder as your other batch file. Then you would have
no need to reference the drive letter at all.

--
Jon



I was more than a little surprised to hear the following from "jdm"
<(E-Mail Removed)> in message
news:666A8283-1D4D-4B69-9766-(E-Mail Removed)...
> It shouldn't matter if they have more than 1 CD-ROM drive, because it will
> all run from 1 drive. I already have the autorun set up to launch the
> first
> batch file. But that batch file will need to call (if the drive letter is
> D)
> D:\folder1\app1.exe.
>
> Obviously, I can't put D: in there, as someone else's drive letter may be
> different. I know it can be done, as I've done it a long time ago. It's
> something like
> "%root%\folder1\app1.exe" but I just remember it...
>
>
> "Claymore" wrote:
>
>>
>> Hi,
>>
>> Don't know a variable for a CD-ROM drive, and what if the user has
>> multiple CD-ROM drives?
>>
>> Would it work to put an autorun file on the CD and point it to the file
>> you want to start, or put your batch file on the CD and point the
>> autorun file to the batch file?
>>
>>


 
Reply With Quote
 
Ayush
Guest
Posts: n/a
 
      17th Nov 2006
If the batch file is on the same drive (CD) then use relative paths.
Example :
If the batch file is "Cd:\XXX\batch.bat" then use :
xxx.exe >to launch CD:\XXX\xxx.exe
...\xx.exe >to launch CD:\xx.exe


--
Ayush [ Be ''?'' Happy ]

Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/

Replied to [jdm]'s message :
-----------------------------------------------------------
> It shouldn't matter if they have more than 1 CD-ROM drive, because
> it
> will all run from 1 drive. I already have the autorun set up to
> launch the first batch file. But that batch file will need to call
> (if the drive letter is D) D:\folder1\app1.exe.
>
> Obviously, I can't put D: in there, as someone else's drive letter
> may be different. I know it can be done, as I've done it a long
> time
> ago. It's something like
> "%root%\folder1\app1.exe" but I just remember it...
>
>
> "Claymore" wrote:
>
>>
>> Hi,
>>
>> Don't know a variable for a CD-ROM drive, and what if the user has
>> multiple CD-ROM drives?
>>
>> Would it work to put an autorun file on the CD and point it to the
>> file you want to start, or put your batch file on the CD and point
>> the autorun file to the batch file?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigned new drive letter to DVD drive. Reverts to old letter on reboot. Rob Windows XP General 6 6th Jul 2007 08:07 PM
USB drive letter to an environment variable? Noozer Windows XP General 1 11th Sep 2006 12:51 AM
Stupid SYSPREP assigns drive letter to partition with no previous letter bruneauhm@hotmail.com Windows XP Setup 0 21st Jun 2006 10:16 PM
USB Drive Letter Mapping - Conflict with network drive letter John Phillip Windows XP Hardware 2 4th Oct 2005 11:24 PM
Hard Disk Drive Letter Assigned Letter E Robert Di Carlo Windows XP Setup 1 1st Sep 2004 03:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:38 PM.