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.
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)
"Cyber Man" <cib...@nospam.usa.net> wrote in message
news:3b7b9ba4...@news.hknet.com...
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
It's nice to see other people are putting Bennylevel to use. :-)
@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
I think this item was covered here in the past year or so but I forget the
context of the discussion.