Can somebody explain me?

January 30, 2011 at 13:20:54
Specs: Windows 7, 2 GHz/2 GB
I have a bootable flopy disk with Win98se Dos files on it. In it's autoexec.bat file there are 2 lines:
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

Can some one explain me what the functions of both above lines are?
I know that these lines are expressions of DOS SET command, where "LglDrv=" specifies the environment-variable name that accept the string after it. As I do not know what the name "LglDrv" means as well as the string after it, I can't understand the function of the SET command in that place of autoexec.bat file.


See More: Can somebody explain me?

Report •

January 30, 2011 at 21:18:54
There are two lines because one line would be too big to use. In the second line %LglDrv% is used to add to itself as already defined in line one. A similar function is done in BASIC when one does:
let A=A+A

The variable is a paired value with the ascii alphabet and the decimal system running backwards from 27 paired with *, 26 paired with Z, 25 paired with Y and so on.

The pupose comes to fruition in the setramd.bat file after the custom made findramd.exe has run and has determined which drive number was assigned to the ramdisk and then next in order the CDROM drive, such that we can use those drives by their drive letters. Apparently findramd.exe returns an error level type of result based on numbers and we still need that information in drive letters. And thus the reason for the paired variable %LglDrv%. It helps us find the corresponding drive letter of both the ramdisk and the CDROM drive.

In setramd.bat it say:

and just above that is set cdrom=%2
The second parameter (%2) passed to the setramd.bat file was the %LglDrv% variable and by doing shift shift we are running down the variable in pairs and when we branch out of that shift loop we are sitting on the drive number and LETTER we need to use for the CDROM. Shift shift again and we also have the ramdisk LETTER. The paired variable is in fact built one off from being exactly right on and this built in 'error' allows us to name both the ramdisk and CDROM by letter with only one find operation by using a convoluted loop that sets %CDROM% and %RAMD% in turn with every possible value in %LglDrv% until it branchs out and away the correct values in play.

MS-DOS doesn't have an assign letter type of ramdisk setup tool and would rather have the ramdisk take up the next open slot behind the last usable partition that DOS can see. And after that slot then the CDROM drive and then that letter has to be passed to MSCDEX.EXE in order to install the DOS level CRROM driver properly. Their solution was to make one findramd.exe that both sets up a ramdisk and returns an error level type of number result that can be used to find the letter that corresponds to the ramdisk. Error level results are ranked by number only. Then the need for a paired number and letter variable named %LglDrv% Clear as mud yet?

Batch won't make you crazy, I promise...


Report •

January 31, 2011 at 14:11:15
Thanks <melee5>,

I'm stil standing there, but the level of the mud went half down. I'll look again at autoexec.bat and config.sys files of my bootable flopy as an attempt to clear their logic up.
The more I think on your reply the more questions appear, for example:
- in variable %LglDrv% - the letter string LglDrv is abriviation of what? (after having read your reply I started to accept it stands for Logical Drive - Im I right?),
- in variable %PATH% - the letter string PATH makes us thinking
of A:, or C:\ , etc - specifying any directories. Obviously, the string "PATH" is more meaningful than LglDrv.

As for batching, it really won't me make me crazy. I fill I liked it. That's why I posted my first question. But I have another: How / Where can i get a complete list of MS Dos variables used in bach file commands?
Anyway, thanks again,


Report •

February 2, 2011 at 00:05:26
Who knows? I thought %LglDrv% might stand for Legal Drive - it really doesn't matter.

The variable %PATH% is exactly the same as %LglDrv% and no real difference between them except for the letters used in the names and the contents assigned to them. You seem to be thinking that they are pre-assigned somehow and they are NOT. YOU make them what you want them to represent. %LglDrv% could just as easily contained directory strings just as the standard MS-DOS path statement does - they can hold almost anything you want them too. And are made up on the spot. Path is a common one and not to be tinkered with lightly, there are few like it if that was the question, most are NOT so common.

And I have mispoke somewhat. I said the 2nd parameter passed was %LglDrv% and then when setramd.bat did:

cdrom was set to the value in %LglDrv% but it's more accurate to state that %1 would equal the numeric error level to be tested and that value would be paired with the %2 value. They are testing on the %1 level and assigning drive letters on the %2 value and then do shift shift to change both data points to the next pair of data which are one less number and one less letter value.

They don't pass two parameters as I implied. I was thinking of the batch rule that the first parameter is always the drive letter+path and file name of the batch file itself and it doesn't need to be passed as that is done automatically in batch. The 2nd parameter is indeed %LglDrv%.

This conversation really should take place in the Programming or Disk Op. System forums. There are also other killer batch forums on the web.
and many, many more.

You are very welcome.


Report •

Related Solutions

Ask Question