|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:|
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...