CD Drive letter variable

G

Guest

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!
 
C

Claymore

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?
 
J

Jon

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
 
G

Guest

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...
 
P

Pegasus \(MVP\)

jdm said:
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)".
 
J

Jon

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"
 
A

Ayush

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 :
-----------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top