NIKZZZZ
Gold Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору !BAT :: GRUB4DOS batch script. See Tutorial at www.rmprepusb.com Tutorial #96 :: Uses: Adds all *.iso file contents to make a single menu :: :: Usage: in menu.lst, put \grub\autolinuxmenu.bat .autolinuxmenu (folder that has .iso files) :: then load using configfile (md)0x3000+0x50 :: An optional \grub\linuxuser.mnu file can be included to contain default menu settings (color etc.) :: This script used the default image file path as %2 variable - e.g. /_ISO/Linux :: A menu file is generated in memory by this code for all ISO files in the /%2 folder and below :: Run this grub4dos batch file using the following 2 lines :: \grub\AutoLinux.bat .Automenu /_ISO/Linux :: Configfile (md)0x3000+0x50 :: :: This script requires GRUB4DOS 2010-12-14 or later. :: and requires the file /grub/WENV :: If ELBACKUP=YES then a copy of the generated menu will be written to :: LBACKMENU specifies the configfile to return back to :: version 1 18 December 2012 :: ::============================================================================= ::set DD=0 ::Uncomment line below to show debug lines ::set DD=1 debug off checkrange 20101214:-1 read 0x8278 || echo Err.version && exit 1 :: this batch file calls itself, so use the label as the place to jump to goto %~x1 exit :.automenu :: Variables: %0=/grub/automenu.bat %~nx0=automenu.bat %~nx1=.automenu %1=.automenu %~x1=.automenu ::echo 0=%0 nx0=%~nx0 nx1=%~nx1 nx2=%~nx2 nx3=%~nx3 1=%1 x1=%~x1 :: get the menu folder into DIR variable ::echo AUTOMENU: checking if wenv is loaded - if not load it delmod -l wenv || insmod /grub/WENV ::echo Checking if .makemenu is loaded - if not load it delmod -l %~nx0 || insmod %0 .makemenu if "%DD%"=="1" echo Writing default menu entry if "%DD%"=="1" echo -e default 0\n#timeout 10\n\n > (md)0x3000+0x50 if exist (bd)/grub/linuxuser.mnu echo Using default user menu /grub/LINUXUSER.MNU... cat --length=0 (bd)/grub/linuxuser.mnu && cat (bd)/grub/linuxuser.mnu > (md)0x3000+0x50 set ME=%0 if "%2"=="" goto :endloop set DIR=%2 echo Using %DIR% as main folder for .iso files echo set MFOLDER=%DIR% >> (md)0x3000+0x50 echo Looking for .iso files starting at %DIR%/ ls %DIR%/ | call :cpa :endloop ::echo writing 'back to main menu' entry into menu as last item echo -e -n \n >> (md)0x3000+0x50 echo -e title Обратно в меню \\n Возврат в первое меню. >> (md)0x3000+0x50 if "%LBACKMENU%"=="" set LBACKMENU=(bd)/menu.lst echo -e \nconfigfile %LBACKMENU% >> (md)0x3000+0x50 :: list menu ::cat (md)0x3000+0x50 ::pause set DD= set DIR= set hlp= :: must set root back! root (bd)/ if "%ELBACKUP%"=="YES" echo BACKING UP TO /grub/LINUXBACKUP.lst... if "%ELBACKUP%"=="YES" cat (md)0x3000+0x50 > (bd)/grub/LINUXBACKUP.lst if "%ELBACKUP%"=="YES" pause debug on exit :: ----------------------- SUBROUTINES ---------------------- :.makemenu if "%DD%"=="1" echo @MAKEMENU setlocal if "%DD%"=="1" echo Checking (bd)%DIR%/%1 if "%1"=="" endlocal && goto :EOF ::If is a directory ignore it cat --length=0 (bd)%DIR%/%1 || goto :EOF :: if not iso file then ignore if "%DD%"=="1" echo MAKEMENU: checking %~x1 extension WENV check "#.iso#"=="#%~x1#" || goto :EOF set hlp=\n Запуск из образа %1 (создается 4 виртуальный раздел на USB )\n Так как создается виртуальный раздел с файловой системой\n нужной именно запускаемому образу, файловая система на самом носителе не имеет жначения. echo %1 > (md)0x2800+1 && cat --locatei=ophcrack (md)0x2800+1 > nul && set hlp=\nTo find the tables type: su root, mkdir /media/oph, mount /dev/sdb4 /media/oph and then run Launcher. && echo FOUND OPHCRACK! echo ADDING %DIR%/%1 echo title %1 %hlp% >> (md)0x3000+0x50 echo partnew (hd0,3) 0x00 %DIR%/%1 >> (md)0x3000+0x50 echo map %DIR%/%1 (0xff) >> (md)0x3000+0x50 echo map --hook >> (md)0x3000+0x50 echo root (0xff) >> (md)0x3000+0x50 echo chainloader (0xff) >> (md)0x3000+0x50 echo >> (md)0x3000+0x50 goto :EOF :cpa if "%DD%"=="1" echo @CPA: Current Root: %DIR% if "%DD%"=="1" echo Change source root to (bd)%DIR%/ root (bd)%DIR%/ ls | call :copyfiles goto :eof :copyfiles if "%DD%"=="1" echo @COPYFILES %1 if "%1"=="" goto :eof ::If is a directory cat --length=0 /%1 || goto :sub-dir ::copy file if "%DD%"=="1" echo @COPY FILE call :.makemenu %1 shift goto :copyfiles :sub-dir if "%DD%"=="1" echo @SUB_DIR %1 setlocal set DIR=%DIR%/%1 call :cpa endlocal shift goto :copyfiles |