Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to discover the second CDROM boot drive letter from MSDOS batch?

1 view
Skip to first unread message

Cyber Man

unread,
Aug 16, 2001, 6:14:29 AM8/16/01
to
The "SETRAMD.BAT" that created by the Windows setup diskette detects
the first CDROM drive only. What happens if I boot from the second
drive?

Some bootdrive batch file used COMSPEC to determine boot drive fails
because the bootdrive batch file will be fooled by the pre-set BOOTIMG
of "COMSPEC=A:\COMMAND.COM" when created by the bootable CDR.

Please help!!!

Thank you very much for your assistance.

Best regards,
Ciba Lo <cib...@nospam.usa.net>

PLEASE NOTE: The return email address has been altered to
frustrate email spammers. If you reply this message to me,
please remove "nospam." for correct address.

Todd Vargo

unread,
Aug 16, 2001, 10:08:51 AM8/16/01
to

"Cyber Man" <cib...@nospam.usa.net> wrote in message
news:3b7b9ba4...@news.hknet.com...

> The "SETRAMD.BAT" that created by the Windows setup diskette detects
> the first CDROM drive only. What happens if I boot from the second
> drive?
>
> Some bootdrive batch file used COMSPEC to determine boot drive fails
> because the bootdrive batch file will be fooled by the pre-set BOOTIMG
> of "COMSPEC=A:\COMMAND.COM" when created by the bootable CDR.
>
> Please help!!!
>
> Thank you very much for your assistance.

It's been a while since I posted this. In your case, replace FILENAME.EXT
with BOOTIMG.BIN and put your commands in. You may want to replace all
instances of %TEMP% with %RAMD%, or just put "set TEMP=%RAMD%" before the
echo command (your choice).


:: FIND_CD.BAT
::
:: Replace FILENAME.EXT below with the name of a file on
:: the CD. For best results, don't use a common file name
:: like, setup.exe or install.exe or autorun.inf, etc.
:: that may exist on other CD's.
::
:: The only requirement of this batch is that it must be
:: able to create a temporary file in either, the location
:: the TEMP variable points to, or the current directory.
::
:: All lines begin with 2 spaces. Any lines beginning in
:: the first column have wrapped from preceding line.
::
@echo off
if %1'==find_cd' goto %1
set cd=?
if not ?'==%cd%' goto end
echo It's safe to delete this temporary file.>%temp%.\cd_found.no
if not exist %temp%.\cd_found.no echo Could not create temporary file.
if not exist %temp%.\cd_found.no goto end
call %0 find_cd C D E F G H I J K L M N O P Q R S T U V W X Y Z
del %temp%.\cd_found.*>nul
if ?==%cd% for %%? in (echo goto:end) do %%? CD is not in drive!
echo Drive letter of CD-ROM is %cd%:
::
:: *** Put your install commands here. ***
::
goto end
:find_cd
%comspec% nul/f/c if exist %2:\FILENAME.EXT ren %temp%.\cd_found.no
*.yes>nul
if exist %temp%.\cd_found.yes set cd=%2
shift
if %cd%'==?' if not %2'==' goto find_cd
:end
if not exist %temp%.\cd_found.* set cd=


--
Todd Vargo (body of message must contain my name to reply by email)

FN

unread,
Aug 16, 2001, 12:49:32 PM8/16/01
to
I'm sorry this doesn't help your issue, but would you mind posting the
"source" for SETRAMD.BAT ? I can't seem to find it on my w2k system.


"Cyber Man" <cib...@nospam.usa.net> wrote in message
news:3b7b9ba4...@news.hknet.com...

Frank-Peter Schultze

unread,
Aug 16, 2001, 7:09:43 PM8/16/01
to
"FN" <newsgrou...@DELETECAPSyahoo.com> schrieb im Newsbeitrag news:wQSe7.220$uh1.1...@typhoon.san.rr.com...

> I'm sorry this doesn't help your issue, but would you mind posting the
> "source" for SETRAMD.BAT ? I can't seem to find it on my w2k system.

You won't find SETRAMD.BAT on a non-Win98 system, since this batch file
is part of the Windows 98 Emergency Boot Disk. Whatever, SETRAMD.BAT
"assumes" that the drive letter assigned to the CDROM drive follows the
ramdrive's drive letter, for example, if the ramdrive has drive letter
D: the CDROM variable will be set to E:

The EBD's AUTOEXEC.BAT calls SETRAMD.BAT as follows:

:______________________________________________________________________
:
set LglDrv=27 * 26 Z 25 Y 24 X 23 W 22 V 21 U 20 T 19 S 18 R 17 Q 16 P 15
set LglDrv=%LglDrv% O 14 N 13 M 12 L 11 K 10 J 9 I 8 H 7 G 6 F 5 E 4 D 3 C
cls
call setramd.bat %LglDrv%
:______________________________________________________________________
:

SETRAMD.BAT looks like this (german version)


:______________________________________________________________________
:
@echo off
set RAMD=
set CDROM=

echo.
echo Laufwerk für Diagnoseprogramme wird gesucht...
echo.

a:\findramd

if errorlevel 255 goto no_ramdrive

if not errorlevel 4 goto no_ramdrive

goto do_shift

:loop
if errorlevel %1 goto no_shift

:do_shift
set cdrom=%2
shift
shift
if not %1*==* goto loop
goto no_ramdrive

:no_shift
set ramd=%2

if "%RAMD%"=="C" goto c_drive

goto success

:c_drive
echo FEHLER: Laufwerk C: wurde nicht mit FDISK bearbeitet. Führen Sie
echo FDISK aus, und wiederholen Sie den Vorgang. Einige Viren können
echo Laufwerk C: ebenfalls entfernen. Führen Sie ein Antivirenprogramm aus.

:no_ramdrive
echo Beim Starten des Computers ist ein Fehler aufgetreten. Mit dieser
echo Startdiskette konnte kein RAM-Laufwerk erstellt werden, da nicht
echo genügend Erweiterungsspeicher (mind. 2 MB) verfügbar ist.

:success

:______________________________________________________________________
:

Note that SETRAMD.BAT executes FINDRAMD.EXE (a:\findramd), a program
that sweeps all possible drive letters to find a ramdrive. (It simply
searches for the volume label, "MS-RAMDRIVE", therefore it fails with
3rd party ramdrive drivers.) FINDRAMD.EXE returns an exit code
indicating the drive letter (1=A, 2=B, .., 26=Z)

BTW, determining the ramdrive letter using FINDRAMD.EXE and BennyLevel
ERRORLEVEL Checking requires only two command lines:

Findramd.exe
For %%D In (C D E F G H I J K M N O P Q R S T U V W X Y Z) Do If ErrorLevel H%%D Set RAMD=%%D

Perhaps, Benny knows how to compress this into one line ;-)

--
Frank-Peter Schultze <fpsch...@my-deja.com>, http://www.fpschultze.de

Todd Vargo

unread,
Aug 16, 2001, 11:57:25 PM8/16/01
to

"Frank-Peter Schultze" <fpsch...@my-deja.com> wrote in message
news:9lhjrt$9dp8b$2...@ID-53039.news.dfncis.de...
[snip]

> BTW, determining the ramdrive letter using FINDRAMD.EXE and BennyLevel
> ERRORLEVEL Checking requires only two command lines:
>
> Findramd.exe
> For %%D In (C D E F G H I J K M N O P Q R S T U V W X Y Z) Do If
ErrorLevel H%%D Set RAMD=%%D
>
> Perhaps, Benny knows how to compress this into one line ;-)

It's nice to see other people are putting Bennylevel to use. :-)

Cyber Man

unread,
Aug 17, 2001, 9:06:04 PM8/17/01
to
"Todd Vargo" <t...@birdlover.com> wrote:

Thank you very much for your help!!!

Benny Pedersen

unread,
Aug 20, 2001, 2:15:51 PM8/20/01
to

"Frank-Peter Schultze" <fpsch...@my-deja.com> wrote news:9lhjrt$9dp8b$2...@ID-53039.news.dfncis.de...

@echo off

If two lines is to much, then use this one:

Findramd.exe|FOR %%D in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if errorlevel H%%D set RAMD=%%D

but the above variable %RAMD% maybe also is to much? <g>, so, use this one:

Findramd.exe|FOR %%D in (Z Y X W V U T S R Q P O N M L K J I H G F E D C) do if errorlevel H%%D %comspec%/cecho. (%%D)

The reson for not writing a whole batch in one line is that Microsoft would
like to sell you a new OS when your computer is dead because, the temporary
folder would be filled up with files such as AABIGPIK, etc., so, if you are
using one of the above ONE-LINES, then I would suggest that you finish your
batch file as this: "DEL %TEMP%.\*." and the AHBIGPIG files should be gone.

FOR %%v in ("choice Erase" if:not" errorlevel 2 del/p" cls) do %%v %temp%.\*.
:EOF

Benny, btw. I did a new discovery yesterday which I think can be
used to spare two lines in some/most batch files.
For more information, see page:
http://users.cybercity.dk/~bse26236/batutil/help/GOTO_E.HTM#1a

Todd Vargo

unread,
Aug 21, 2001, 2:32:38 AM8/21/01
to

"Benny Pedersen" <b.ped...@get2net.dk> wrote in message
news:Fxcg7.185$Zm6....@news.get2net.dk...

>
> Benny, btw. I did a new discovery yesterday which I think can be
> used to spare two lines in some/most batch files.
> For more information, see page:
> http://users.cybercity.dk/~bse26236/batutil/help/GOTO_E.HTM#1a

I think this item was covered here in the past year or so but I forget the
context of the discussion.

0 new messages