Hi.
First, thank you DarkPhoeniX, steve6375 and Wonko for the scripts and for the good ideas.
But I noticed that the speed is still an issue, especially when you try to search into a higher number of drives/partitions (3..5).
The "culprits" are:
- the "find" function (used twice instead of one time);
- the "iftitle"'s;
So I modified the script for one "find" and no "iftitle"'s.
ntsearch.lst:
clear
echo Please wait, searching...
debug 1
debug on
find --ignore-floppies --ignore-cd /ntldr > (md)0x220+1
debug off
cat --locate="(hd0,0)" (md)0x220+1 > nul && set BNTM11=title Boot to Windows NT/2000/XP on first HDD, first partition\\nUsually the USB drive...\r\nroot (hd0,0)\r\nchainloader /ntldr\r\n
cat --locate="(hd0,1)" (md)0x220+1 > nul && set BNTM12=title Boot to Windows NT/2000/XP on first HDD, second partition\\nUsually the USB drive...\r\nroot (hd0,1)\r\nchainloader /ntldr\r\n
cat --locate="(hd0,2)" (md)0x220+1 > nul && set BNTM13=title Boot to Windows NT/2000/XP on first HDD, third partition\\nUsually the USB drive...\r\nroot (hd0,2)\r\nchainloader /ntldr\r\n
cat --locate="(hd0,3)" (md)0x220+1 > nul && set BNTM14=title Boot to Windows NT/2000/XP on first HDD, fourth partition\\nUsually the USB drive...\r\nroot (hd0,3)\r\nchainloader /ntldr\r\n
cat --locate="(hd0,4)" (md)0x220+1 > nul && set BNTM15=title Boot to Windows NT/2000/XP on first HDD, fifth partition\\nUsually the USB drive...\r\nroot (hd0,4)\r\nchainloader /ntldr\r\n
cat --locate="(hd1,0)" (md)0x220+1 > nul && set BNTM21=title Boot to Windows NT/2000/XP on second HDD, first partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,0)\r\nchainloader /ntldr\r\n
cat --locate="(hd1,1)" (md)0x220+1 > nul && set BNTM22=title Boot to Windows NT/2000/XP on second HDD, second partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,1)\r\nchainloader /ntldr\r\n
cat --locate="(hd1,2)" (md)0x220+1 > nul && set BNTM23=title Boot to Windows NT/2000/XP on second HDD, third partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,2)\r\nchainloader /ntldr\r\n
cat --locate="(hd1,3)" (md)0x220+1 > nul && set BNTM24=title Boot to Windows NT/2000/XP on second HDD, fourth partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,3)\r\nchainloader /ntldr\r\n
cat --locate="(hd1,4)" (md)0x220+1 > nul && set BNTM25=title Boot to Windows NT/2000/XP on second HDD, fifth partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,4)\r\nchainloader /ntldr\r\n
cat --locate="(hd2,0)" (md)0x220+1 > nul && set BNTM31=title Boot to Windows NT/2000/XP on third HDD, first partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,0)\r\nchainloader /ntldr\r\n
cat --locate="(hd2,1)" (md)0x220+1 > nul && set BNTM32=title Boot to Windows NT/2000/XP on third HDD, second partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,1)\r\nchainloader /ntldr\r\n
cat --locate="(hd2,2)" (md)0x220+1 > nul && set BNTM33=title Boot to Windows NT/2000/XP on third HDD, third partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,2)\r\nchainloader /ntldr\r\n
cat --locate="(hd2,3)" (md)0x220+1 > nul && set BNTM34=title Boot to Windows NT/2000/XP on third HDD, fourth partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,3)\r\nchainloader /ntldr\r\n
cat --locate="(hd2,4)" (md)0x220+1 > nul && set BNTM35=title Boot to Windows NT/2000/XP on third HDD, fifth partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,4)\r\nchainloader /ntldr\r\n
cat --locate="(hd3,0)" (md)0x220+1 > nul && set BNTM41=title Boot to Windows NT/2000/XP on fourth HDD, first partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,0)\r\nchainloader /ntldr\r\n
cat --locate="(hd3,1)" (md)0x220+1 > nul && set BNTM42=title Boot to Windows NT/2000/XP on fourth HDD, second partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,1)\r\nchainloader /ntldr\r\n
cat --locate="(hd3,2)" (md)0x220+1 > nul && set BNTM43=title Boot to Windows NT/2000/XP on fourth HDD, third partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,2)\r\nchainloader /ntldr\r\n
cat --locate="(hd3,3)" (md)0x220+1 > nul && set BNTM44=title Boot to Windows NT/2000/XP on fourth HDD, fourth partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,3)\r\nchainloader /ntldr\r\n
cat --locate="(hd3,4)" (md)0x220+1 > nul && set BNTM45=title Boot to Windows NT/2000/XP on fourth HDD, fifth partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,4)\r\nchainloader /ntldr\r\n
cat --locate="(hd4,0)" (md)0x220+1 > nul && set BNTM51=title Boot to Windows NT/2000/XP on fifth HDD, first partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,0)\r\nchainloader /ntldr\r\n
cat --locate="(hd4,1)" (md)0x220+1 > nul && set BNTM52=title Boot to Windows NT/2000/XP on fifth HDD, second partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,1)\r\nchainloader /ntldr\r\n
cat --locate="(hd4,2)" (md)0x220+1 > nul && set BNTM53=title Boot to Windows NT/2000/XP on fifth HDD, third partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,2)\r\nchainloader /ntldr\r\n
cat --locate="(hd4,3)" (md)0x220+1 > nul && set BNTM54=title Boot to Windows NT/2000/XP on fifth HDD, fourth partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,3)\r\nchainloader /ntldr\r\n
cat --locate="(hd4,4)" (md)0x220+1 > nul && set BNTM55=title Boot to Windows NT/2000/XP on fifth HDD, fifth partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,4)\r\nchainloader /ntldr\r\n
if "%BNTM11%%BNTM12%%BNTM13%%BNTM14%%BNTM15%%BNTM21%%BNTM22%%BNTM23%%BNTM24%%BNTM25%%BNTM31%%BNTM32%%BNTM33%%BNTM34%%BNTM35%%BNTM41%%BNTM42%%BNTM43%%BNTM44%%BNTM45%%BNTM51%%BNTM52%%BNTM53%%BNTM54%%BNTM55%"=="" clear && echo No bootable Windows NT/2000/XP partitions found, returning to main menu... && pause --wait=5 && configfile (bd)/menu.lst
write (md)0x220+2 %BNTM11%%BNTM12%%BNTM13%%BNTM14%%BNTM15%%BNTM21%%BNTM22%%BNTM23%%BNTM24%%BNTM25%%BNTM31%%BNTM32%%BNTM33%%BNTM34%%BNTM35%%BNTM41%%BNTM42%%BNTM43%%BNTM44%%BNTM45%%BNTM51%%BNTM52%%BNTM53%%BNTM54%%BNTM55%title\r\nroot\r\ntitle Return to main menu...\r\nconfigfile (bd)/menu.lst\r\n\0
configfile (md)0x220+2
mgrsearch.lst:
clear
echo Please wait, searching...
debug 1
debug on
find --ignore-floppies --ignore-cd /bootmgr > (md)0x220+1
debug off
cat --locate="(hd0,0)" (md)0x220+1 > nul && set BMGRM11=title Boot to Windows Vista/7/8 on first HDD, first partition\\nUsually the USB drive...\r\nroot (hd0,0)\r\nchainloader /bootmgr\r\n
cat --locate="(hd0,1)" (md)0x220+1 > nul && set BMGRM12=title Boot to Windows Vista/7/8 on first HDD, second partition\\nUsually the USB drive...\r\nroot (hd0,1)\r\nchainloader /bootmgr\r\n
cat --locate="(hd0,2)" (md)0x220+1 > nul && set BMGRM13=title Boot to Windows Vista/7/8 on first HDD, third partition\\nUsually the USB drive...\r\nroot (hd0,2)\r\nchainloader /bootmgr\r\n
cat --locate="(hd0,3)" (md)0x220+1 > nul && set BMGRM14=title Boot to Windows Vista/7/8 on first HDD, fourth partition\\nUsually the USB drive...\r\nroot (hd0,3)\r\nchainloader /bootmgr\r\n
cat --locate="(hd0,4)" (md)0x220+1 > nul && set BMGRM15=title Boot to Windows Vista/7/8 on first HDD, fifth partition\\nUsually the USB drive...\r\nroot (hd0,4)\r\nchainloader /bootmgr\r\n
cat --locate="(hd1,0)" (md)0x220+1 > nul && set BMGRM21=title Boot to Windows Vista/7/8 on second HDD, first partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,0)\r\nchainloader /bootmgr\r\n
cat --locate="(hd1,1)" (md)0x220+1 > nul && set BMGRM22=title Boot to Windows Vista/7/8 on second HDD, second partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,1)\r\nchainloader /bootmgr\r\n
cat --locate="(hd1,2)" (md)0x220+1 > nul && set BMGRM23=title Boot to Windows Vista/7/8 on second HDD, third partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,2)\r\nchainloader /bootmgr\r\n
cat --locate="(hd1,3)" (md)0x220+1 > nul && set BMGRM24=title Boot to Windows Vista/7/8 on second HDD, fourth partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,3)\r\nchainloader /bootmgr\r\n
cat --locate="(hd1,4)" (md)0x220+1 > nul && set BMGRM25=title Boot to Windows Vista/7/8 on second HDD, fifth partition\\nUsually the first internal HDD...\r\nmap (hd1) (hd0)\r\nmap --hook\r\nroot (hd0,4)\r\nchainloader /bootmgr\r\n
cat --locate="(hd2,0)" (md)0x220+1 > nul && set BMGRM31=title Boot to Windows Vista/7/8 on third HDD, first partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,0)\r\nchainloader /bootmgr\r\n
cat --locate="(hd2,1)" (md)0x220+1 > nul && set BMGRM32=title Boot to Windows Vista/7/8 on third HDD, second partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,1)\r\nchainloader /bootmgr\r\n
cat --locate="(hd2,2)" (md)0x220+1 > nul && set BMGRM33=title Boot to Windows Vista/7/8 on third HDD, third partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,2)\r\nchainloader /bootmgr\r\n
cat --locate="(hd2,3)" (md)0x220+1 > nul && set BMGRM34=title Boot to Windows Vista/7/8 on third HDD, fourth partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,3)\r\nchainloader /bootmgr\r\n
cat --locate="(hd2,4)" (md)0x220+1 > nul && set BMGRM35=title Boot to Windows Vista/7/8 on third HDD, fifth partition\\nUsually the second internal HDD...\r\nmap (hd2) (hd0)\r\nmap --hook\r\nroot (hd0,4)\r\nchainloader /bootmgr\r\n
cat --locate="(hd3,0)" (md)0x220+1 > nul && set BMGRM41=title Boot to Windows Vista/7/8 on fourth HDD, first partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,0)\r\nchainloader /bootmgr\r\n
cat --locate="(hd3,1)" (md)0x220+1 > nul && set BMGRM42=title Boot to Windows Vista/7/8 on fourth HDD, second partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,1)\r\nchainloader /bootmgr\r\n
cat --locate="(hd3,2)" (md)0x220+1 > nul && set BMGRM43=title Boot to Windows Vista/7/8 on fourth HDD, third partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,2)\r\nchainloader /bootmgr\r\n
cat --locate="(hd3,3)" (md)0x220+1 > nul && set BMGRM44=title Boot to Windows Vista/7/8 on fourth HDD, fourth partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,3)\r\nchainloader /bootmgr\r\n
cat --locate="(hd3,4)" (md)0x220+1 > nul && set BMGRM45=title Boot to Windows Vista/7/8 on fourth HDD, fifth partition\\nUsually the third internal HDD...\r\nmap (hd3) (hd0)\r\nmap --hook\r\nroot (hd0,4)\r\nchainloader /bootmgr\r\n
cat --locate="(hd4,0)" (md)0x220+1 > nul && set BMGRM51=title Boot to Windows Vista/7/8 on fifth HDD, first partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,0)\r\nchainloader /bootmgr\r\n
cat --locate="(hd4,1)" (md)0x220+1 > nul && set BMGRM52=title Boot to Windows Vista/7/8 on fifth HDD, second partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,1)\r\nchainloader /bootmgr\r\n
cat --locate="(hd4,2)" (md)0x220+1 > nul && set BMGRM53=title Boot to Windows Vista/7/8 on fifth HDD, third partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,2)\r\nchainloader /bootmgr\r\n
cat --locate="(hd4,3)" (md)0x220+1 > nul && set BMGRM54=title Boot to Windows Vista/7/8 on fifth HDD, fourth partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,3)\r\nchainloader /bootmgr\r\n
cat --locate="(hd4,4)" (md)0x220+1 > nul && set BMGRM55=title Boot to Windows Vista/7/8 on fifth HDD, fifth partition\\nUsually the fourth internal HDD...\r\nmap (hd4) (hd0)\r\nmap --hook\r\nroot (hd0,4)\r\nchainloader /bootmgr\r\n
if "%BMGRM11%%BMGRM12%%BMGRM13%%BMGRM14%%BMGRM15%%BMGRM21%%BMGRM22%%BMGRM23%%BMGRM24%%BMGRM25%%BMGRM31%%BMGRM32%%BMGRM33%%BMGRM34%%BMGRM35%%BMGRM41%%BMGRM42%%BMGRM43%%BMGRM44%%BMGRM45%%BMGRM51%%BMGRM52%%BMGRM53%%BMGRM54%%BMGRM55%"=="" clear && echo No bootable Windows Vista/7/8 partitions found, returning to main menu... && pause --wait=5 && configfile (bd)/menu.lst
write (md)0x220+2 %BMGRM11%%BMGRM12%%BMGRM13%%BMGRM14%%BMGRM15%%BMGRM21%%BMGRM22%%BMGRM23%%BMGRM24%%BMGRM25%%BMGRM31%%BMGRM32%%BMGRM33%%BMGRM34%%BMGRM35%%BMGRM41%%BMGRM42%%BMGRM43%%BMGRM44%%BMGRM45%%BMGRM51%%BMGRM52%%BMGRM53%%BMGRM54%%BMGRM55%title\r\nroot\r\ntitle Return to main menu...\r\nconfigfile (bd)/menu.lst\r\n\0
configfile (md)0x220+2
I didn't make a script for finding io.sys also because is too old and I haven't seen a computer with 9xME in many years. But, if someone wants it anyway, the script is very easy to "extrapolate" from the other 2. Just use Search&Replace in a text editor...
Also I didn't searched /bootmgr on CD/DVD because, in my opinion, if you have a USB drive, you will want to start /bootmgr faster - so you will copy the CD/DVD in the USB drive and start it from there.
The main "time consumer" is the find function. The rest of the code is quite fast. It's made for 5 drives, each with 5 partitions. But using 2 x 2 or 10 x 10 is not much of a diference (in run time). But for a coder making a 10 x 10 script could be
Since it's my first big grub4dos script I'm sure there are mistakes in it and it needs to be improved.
Just be gentle, don't kill me with the first shot
Regards, David
later edit: I made some small improvements to the scripts...
Later later edit: Well, because of the 512 bytes size limit of the variables in grub4dos, showing 4 or more menu entries was problematic. I fixed that by not using BNTM and BMGRM anymore. The code is a little bit "uglier" but it's functioning better. I updated the scripts.