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

Problem with Bart Lagerweij's FindCD.com !!!

0 views
Skip to first unread message

Guillaume Tamisier

unread,
Apr 27, 2002, 9:43:56 AM4/27/02
to
Hi,

I have a problem with Bart Lagerweij's FindCD.com <http://www.nu2.nu>.
I've recorded a bootable CD and my autoexec.bat calls "findcd
-f\bootcd.id -e" to find the CD-ROM drive letter (I have several
CD-ROM drives so I need to look for a particular file), where
bootcd.id is on my CD. But this command doesn't find the CD, whereas
"findcd.com -a" returns the correct drive letter ! "findcd -r" doens't
find anything too, whereas the CD is well in the CD drive. But if I
put this CD in another CD drive (a CD recorder), then "findcd
-f\bootcd.id" works correctly ! I don't understand where is the
problem.
This CD is a CD-RW and has been recorded with cdrecord like it is
described in "Bart's way to create bootable CD-Roms"
<http://www.nu2.nu/bootcd/>.
Somebody can help me ?

I have another question : I've read in this newsgroup a way to convert
the errorlevel number returned by findcd.com in the correct drive
letter. It's something like :
for %%D in (Z Y X ... E D C) do if not errorlevel H%%D set DRV=%%D
But what does H mean in this command ? Is it a conversion of %%D
(which is a character) in integer ??
Thanks.

Guillaume

William Allen

unread,
Apr 27, 2002, 10:53:00 AM4/27/02
to
"Guillaume Tamisier" wrote in message
...snip

> I have another question : I've read in this newsgroup a way to convert
> the errorlevel number returned by findcd.com in the correct drive
> letter. It's something like :
> for %%D in (Z Y X ... E D C) do if not errorlevel H%%D set DRV=%%D
> But what does H mean in this command ? Is it a conversion of %%D
> (which is a character) in integer ??

This ERRORLEVEL technique is known as BennyLevel and
was discovered by Benny Pedersen. See my post in Note 1
for a detailed explanation of the arithmetic of BennyLevel.

In the case of (a slightly simplified version of) your example
line, it works like this:

FOR %%D IN (E D C) DO IF NOT ERRORLEVEL H%%D SET DRV=%%D

The line expands to three consecutive commands:
(1) IF NOT ERRORLEVEL HE SET DRV=E
(2) IF NOT ERRORLEVEL HD SET DRV=D
(3) IF NOT ERRORLEVEL HC SET DRV=C

For each of those lines, BennyLevel arithmetic works like this:

ERRORLEVEL HE is equvalent to
ERRORLEVE Bv(H) * 10 + Bv(E)
where Bv(H) means the BennyValue of the character H.

The BennyValue of a character is its decimal ASCII code - 48
Note that ASCIIcode(H)=72 decimal ASCIIcode(E)=69 so:

HE translates to (ASCII(H)-48)*10 + ASCII(E)-48 = 240 + 21 = 261
HD translates to (ASCII(H)-48)*10 + ASCII(D)-48 = 240 + 20 = 260
HC translates to (ASCII(H)-48)*10 + ASCII(C)-48 = 240 + 19 = 259

ERRORLEVELs are treated modulo 256, so subtract 256 from
each of these numbers to get the final ERRORLEVEL check
they represent:

So HE= 261 - 256 = a check for ERRORLEVEL 5
So HD= 260 - 256 = a check for ERRORLEVEL 4
So HC= 259 - 256 = a check for ERRORLEVEL 3

Thus the line:
FOR %%D IN (E D C) DO IF NOT ERRORLEVEL H%%D SET DRV=%%D
expands to three consecutive commands:
(1) IF NOT ERRORLEVEL 5 SET DRV=E
(2) IF NOT ERRORLEVEL 4 SET DRV=D
(3) IF NOT ERRORLEVEL 3 SET DRV=C

So, DRV variable is set to the letter corresponding to the
position in the alphabet of the ERRORLEVEL returned.

As I say, read my article below for fuller details.

--
(pp) William Allen

Note 1:
The arithmetic of BennyLevel ERRORLEVEL checking
http://groups.google.com/groups?selm=8va2r4$3vd2a$1...@ID-55970.news.dfncis.de
Date: 20 Nov 2000


William Allen

unread,
Apr 27, 2002, 10:58:08 AM4/27/02
to
"William Allen" wrote in message
...snip

> So, DRV variable is set to the letter corresponding to the
> position in the alphabet of the ERRORLEVEL returned.

Assuming A=position zero, and so on, that is.

> As I say, read my article below for fuller details.

> Note 1:
> The arithmetic of BennyLevel ERRORLEVEL checking
> http://groups.google.com/groups?selm=8va2r4$3vd2a$1...@ID-55970.news.dfncis.de
> Date: 20 Nov 2000

--
(pp) William Allen


Benny Pedersen

unread,
Apr 27, 2002, 2:34:42 PM4/27/02
to

"Guillaume Tamisier" <guillaume...@wanadoo.fr> wrote news:66c4efc0.02042...@posting.google.com...
> Hi,
...[snipped].

> I have another question : I've read in this newsgroup a way to convert
> the errorlevel number returned by findcd.com in the correct drive
> letter. It's something like :
> for %%D in (Z Y X ... E D C) do if not errorlevel H%%D set DRV=%%D
> But what does H mean in this command ? Is it a conversion of %%D
> (which is a character) in integer ??
> Thanks.
>
> Guillaume

Bonjour Tamisier

for %%D in (C D E ... X Y Z) do if errorlevel H%%D set DRV=%%D
rem 3 4 5 24 25 26

for %%D in (Z Y X ... E D C) do if not errorlevel H%%D set DRV=%%D

rem 25 24 23 4 3 2

The first one above (if errorlevel...) checking C D E as errorlevel 3 4 5
The second one, (if not errorlevel...) checking C D E as errorlevel 2 3 4

The following could be prefixed %%D: H 24 xx 9288472 or many other...

Benny Pedersen,
http://2dos.homepage.dk/batutil/NEWS4.HTM#bennylevel

Benny Pedersen

unread,
Apr 28, 2002, 9:51:15 PM4/28/02
to

"Benny Pedersen" <b.ped...@get2net.dk> wrote news:neCy8.60$bV3....@news.get2net.dk...

BTW.
This technique can also be used to other things.
Examples:

@echo off
SET D=1586
if errorlevel %D%0000000 echo %D%/2 = integer.
if errorlevel 0%D%000000 echo %D%/4 = integer.
if errorlevel 00%D%00000 echo %D%/8 = integer.
if errorlevel 000%D%0000 echo %D%/16 = integer.
if errorlevel 0000%D%000 echo %D%/32 = integer.
if errorlevel 00000%D%00 echo %D%/64 = integer.
if errorlevel 000000%D%0 echo %D%/128 = integer.
if errorlevel 0000000%D% echo %D%/256 = integer.
if errorlevel %D%0000128 echo no calc, (%D% is odd).

Benny Pedersen,

BTW. I have updated my Webpage with a little
note: To get the ASCII value of a character,
prefix the input with a lowercase H.

0 new messages