1.

Solve : Deep Deep Mystery.AUTOEXEC.BAT Oh No !?

Answer»

Old '98 AUTOEXEC.BAT Mystery
Here is part of the Windows 98 install diskette.
Code: [Select]@ECHO OFF
set EXPAND=YES
SET DIRCMD=/O:N
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
This first three lines are withing the limits of my brain size. But the next two put me in a coma. Did anybody really know what that 'set' STUFF meant?

We now have something here to provide relief in case i have an an attack.
So GO ahead. Tell me the truth.
After all these years I am not ready to know.
What does it mean?Quote from: Geek-9pm on February 17, 2009, 02:31:19 PM

We now have something here to provide relief in case i have an an attack.

I'll catch you.

Do you have any more of the script?I can't find any autoexec.bat on any of my Windows 98 CDs... or do you mean the boot-up disk?

In any case, It's really quite elementary.


DOS, as well as windows, refers to Drives not as letters, but via numbers- IE: drive A: is 1, drive B is 2, etc.

In this case, it appears to be a lookup table for the drive numbers. Although subtracting 65 from the ASCII value of the letter would be far better, that's what it looks like to me.

for example:

Code: [Select]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

Initializes the variable- 27 is any letter not found (*), 26 is Z, 25 is Y, 24 is X, etc...



Code: [Select]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

avoids the command line length limit by appending to the same environment variable on a separate line- simply continues the same pattern 15 (from the previous line) is ), 14 is N, etc all the way to 3 for C Drive.


What possible use could this have? maybe to define non-floppy drives?
[/quote]Quote
Windows 98 install diskette.
We now call then floppies. Etymology has been lost Quote from: Geek-9pm on February 17, 2009, 03:34:48 PM
Quote
Windows 98 install diskette.
We now call then floppies. Etymology has been lost

thus the confusion. Windows 98 was never distributed on diskette. Windows 95 was, though...Quote
Windows 98 was never distributed on diskette.
If a PC did not have an OS or an OS with a CD driver, you could not install from the CD. So the retail CD has to be sold with a install Diskette to bring up the CD-ROM drivers. Very frustrating.
So there was a very complected way to assign a drive letter to the CD-ROM in case you have many partitions or more HDDs.

They went from A to Z ? What if I had more that 26 drives? Well, that would explain why they had to invent VISTA.


Anyway, I would still like to understand how it would use that stuff to assign the drive letter for the CD-ROM Drive. I would like to re-copy my Win98 CD so that it would be bookable and behave like the A: drive.
Windows 98SE's CD was bootable- the el torito specification was finalized around this time. The diskette, however, was likely supplied as a convenience to those who didn't have a el-torito compatible BIOS.

I couldn't say what it was used for, since the Driver itself didn't assign the drive letter, but MSCDEX did- and it works FINE without it, and can be given switches to change the driver letter assigned (Warranted that drive letter isn't in use).

booting from the Win98 CD creates a RAM disk and assigns it to A:, placing on it all the files that would be on (or, I suspect are on) the win98 bootable Disk.

Couldn't say what it was for. You can always delete the lines and see if it has any negative effect.


EDIT: also, you can have more then 26 drives in any NT based windows from NT 3.1, I believe. but they must be mounted as NTFS folder mount points.Quote from: BC_Programmer on February 17, 2009, 02:43:48 PM
I can't find any autoexec.bat on any of my Windows 98 CDs... or do you mean the boot-up disk?

In any case, It's really quite elementary.


DOS, as well as windows, refers to Drives not as letters, but via numbers- IE: drive A: is 1, drive B is 2, etc.

In this case, it appears to be a lookup table for the drive numbers. Although subtracting 65 from the ASCII value of the letter would be far better, that's what it looks like to me.

for example:

Code: [Select]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

Initializes the variable- 27 is any letter not found (*), 26 is Z, 25 is Y, 24 is X, etc...



Code: [Select]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

avoids the command line length limit by appending to the same environment variable on a separate line- simply continues the same pattern 15 (from the previous line) is ), 14 is N, etc all the way to 3 for C Drive.


What possible use could this have? maybe to define non-floppy drives?
[/quote]

The lines in question do exactly what it states. It sets the logical drive numbers equal to a corresponding letter of the English alphabet: 1=A, 2=B, 3=C, etcetera, all the way to 26= Z. i.e.: It assigns each drive NUMBER, a LETTER, since software (DOS, Windows, etc.) refers to drives as LETTERS, NOT NUMBERS. That is why it is , not <3:\autoexec.bat>. 27 is the first one you can't have.

Quote from: Geek-9pm on February 17, 2009, 03:57:00 PM
Quote
Windows 98 was never distributed on diskette.
If a PC did not have an OS or an OS with a CD driver, you could not install from the CD. So the retail CD has to be sold with a install Diskette to bring up the CD-ROM drivers. Very frustrating.
So there was a very complected way to assign a drive letter to the CD-ROM in case you have many partitions or more HDDs.

They went from A to Z ? What if I had more that 26 drives? Well, that would explain why they had to invent VISTA.


Anyway, I would still like to understand how it would use that stuff to assign the drive letter for the CD-ROM Drive. I would like to re-copy my Win98 CD so that it would be bookable and behave like the A: drive.


It's not that complicated, REALLY! The "disk" is the "Startup Disk" YOU create when you select "Create Startup Disk" during installation or through the control panel.

You will find "lastdrive=z" in the file on the EBD, but must open it with notepad to view/edit. BTW: How tall would your box be with over 20 drives in it? ROFFL!!

Personally I never made it past "F" drive: Two floppy, two HDD or partitions, & two CD. Add a removable USB drive & you get "G" drive, but that's only seven.

The "%" sign on each side of "LglDrv" (Logical Drive) causes it to be a variable, assigning a letter to each drive in a specific sequence, based on hardware considerations such as primary IDE, Secondary IDE, Master, Slave, Jumper selection, etc and the crap in the next two paragraphs. (Leave jumpers on "Cable Select" & fa-ged-a-bah-dit!)

Remember a physical drive can be partitioned into multiple Logical Drives. They are assigned letters as follows starting with "C": All physical in sequence, then logical (as in 2nd & more partitions) then RAMDrive, then removable. A & B are reserved for the floppies & get ignored if there's no internal floppies.

2 HDDs w/2 partitions each would be HD1,p1=C, HD2,p1=D, HD1,p2=E, HD2,p2=F. Then RamDrive directory (if booting w/EBD) becomes G:\ and internal CD-ROM becomes "H" drive.

Quote from: BC_Programmer on February 17, 2009, 04:12:13 PM
Windows 98SE's CD was bootable- the el torito specification was finalized around this time. The diskette, however, was likely supplied as a convenience to those who didn't have a el-torito compatible BIOS.

I couldn't say what it was used for, since the Driver itself didn't assign the drive letter, but MSCDEX did- and it works fine without it, and can be given switches to change the driver letter assigned (Warranted that drive letter isn't in use).

booting from the Win98 CD creates a RAM disk and assigns it to A:, placing on it all the files that would be on (or, I suspect are on) the win98 bootable Disk.

Couldn't say what it was for. You can always delete the lines and see if it has any negative effect.


EDIT: also, you can have more then 26 drives in any NT based windows from NT 3.1, I believe. but they must be mounted as NTFS folder mount points.

DELETING THE LINES WOULD HAVE A DEFINITE NEGATIVE EFFECT!!

The autoexec.bat file in windows is located in the root directory , but is not relevant to the lines in question, which are copied directly from the file in the EBD (Emergency Boot Disk), also known as the startup disk. You can right click 'em and view selecting "edit".

That enuff or way to much. . . please stay on topic & avoid guessing. It's counterproductive.

The MicroSoft knowledge base is very helpful when asking about their copyrighted, licensed files. Googling, results in off-topic answers & misdirection.Quote from: Susar on February 18, 2009, 05:28:11 AM

DELETING THE LINES WOULD HAVE A DEFINITE NEGATIVE EFFECT!!



Chances are the setramd.bat call won't work properly- this is the component that requires the variable. It is passed from autoexec.bat as the argument, which actually passes a number of arguments, and the setramd drive works with it via shift:
Code: [Select]@echo off
set RAMD=
set CDROM=

echo.
echo Preparing to start your computer.
echo This may take a few minutes. Please wait...
echo.

a:\findramd

if errorlevel 255 goto no_ramdrive

if not errorlevel 3 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 Windows 98 has detected that drive C does not contain a valid FAT or
echo FAT32 partition. There are several possible causes.
echo.
echo 1. The drive may need to be partitioned. To create a partition on the drive,
echo run FDISK from the MS-DOS command prompt.
echo.
echo 2. You may be using third-party disk-partitioning software. If you are using
echo this type of software, remove the Emergency Boot Disk and restart your
echo computer. Then, follow the on-screen instructions to start your computer from
echo a floppy disk.
echo .
echo 3. Some viruses also cause your drive C to not register. You can use a virus
echo scanning program to check your computer for viruses.
echo.
goto success

:no_ramdrive
echo The Windows 98 startup disk could not create a temporary drive for the
echo diagnostic tools. This may be because this computer has less than the
echo minimum required extended memory.
echo.
:success

In fact- findramd returns an errorlevel corresponding to the number of the drive, and the variable is used to set the corresponding drive letter variable.


The only negative effect being that no RAM drive is created.(No, it does not affect any other mode of operation, DOS itself does not use the variable- just the batch file)

I've never bothered with the ridiculous setup that is the win98 Boot disk. For win9x I just use my bootable PC-DOS 2000 diskette with a workable environment - chkdsk, fdisk, oakcdrom.sys,mscdex,DOSkey, ANSI.SYS, etc. and autoexec.bat and config.sys with commands to load those drivers I have on the disk.


lastly, only low level DOS interrupt routines that interface with BIOS interrupt 13H would need to use a numeric value to designate the drive- the DOS interrupt routine, IIRC accepts a character designation.
Thanks everybody for this great thread.
I am OK. Took all my pills. But I need to go rest a bit.
I think I will look at another topic for awhile.
What I don't understand is how did the batch know it needed another letter? The full script is rather long and it calls other batch files. So it gets to be hard to foloww. The version I have may be corrupt. I will try to get a new copy off the Windowds 98 machine out in the Barn. But it is very old out. I don't think it is a good idea to turn the old machine on in the cold weather.
So it will be a day or two before I get back onto this.Grab a Win98SE bootdisk from bootdisk.com...
Select the one with CDROM support.Geek, As far as I can tell, the batch "SETRAMD" calls a program(I don't think its a batch, but I don't have an actual boot disk with it on it... but it isn't started with call, so I assume it's a program), FINDRAMD, which is given numbers and letters in the same format as that given to lgldrv- it then returns an errorlevel corresponding to the location of the RAM drive. Note that 27 is returned if there isn't a RAM drive.

This is my guess, since AFAIK RAM drive is created via a CONFIG.SYS device driver, like RAMDISK.SYS or the older VDISK.SYS, Both of which simply use the next available drive letter- all if this roundabout sets and environment setting and so forth is merely a roundabout way of finding the Drive letter that was used for a RAM drive- which is necessary to copy the files to it. It also has some code in there that checks if the RAM drive was "C", which means the users HD wasn't detected or is nonexistent, and echos a message stating that to the user.


Discussion

No Comment Found