Grub4dos Example Menus

'Getting started with grub4dos' - Latest eBook PDF for 2020
Complete grub4dos guide with exercises and full command reference.

The menu entries below cannot just be cut and pasted into one large menu.lst file! You need to just take the bits that you need!

Testing

    • Use a path and filename that does not contain spaces - e.g. ubuntu_x64_test.iso
    • Test on a real system (not just a Virtual Machine)
    • Test on 32-bit and 64-bit systems
    • Test using a USB 2.0 port on an old system (some OS's don't have modern USB controller drivers, e.g .Win7)
    • Test using a non-UASP USB device (some OS's don't have UASP drivers)
    • Test on a FAT32 formatted USB drive if an NTFS drive does not work
    • Test using a Removable-type Flash drive as well as a Fixed-type USB drive

EXAMPLES

The grub4dos menus and code snippets below should be copied into your own menu - DO NOT JUST COPY THIS WHOLE PAGE!

ALWAYS TEST USING A FILENAME THAT DOES NOT CONTAIN ANY SPACES!

NOTE: Kernel parameter values (xxxxx=yyyyy) cannot cope with spaces. Ensure that the ISO filename and path does not contain spaces if you are using a kernel parameter such as fromiso= or iso-scan/filename=. Usually 'escaping' the filename with quotes or using \x20 does not work for the ISO filename.

Please search this site for the relevant tutorials!

Easy2Boot contains better key map batch files for grub4dos 0.4.6a 2020+.

#check version of grub4dos is later than 01-02-2012

checkrange 20120201:-1 read 0x8278 || pause --wait=3 Please use grub4dos-0.4.5c-2012-02-01 or later! && exit 1

#reset key map

setkey

#change key map for UK keyboard

setkey

setkey at doublequote

setkey doublequote at

setkey tilde bar

setkey numbersign backslash

#French

setkey

setkey less backquote

setkey greater tilde

setkey ampersand 1

setkey 1 exclam

setkey tilde 2

setkey 2 at

setkey doublequote 3

setkey 3 numbersign

setkey quote 4

setkey 4 dollar

setkey parenleft 5

setkey 5 percent

setkey minus 6

setkey 6 caret

setkey backquote 7

setkey 7 ampersand

setkey underscore 8

setkey 8 asterisk

setkey backslash 9

setkey 9 parenleft

setkey at 0

setkey 0 parenright

setkey parenright minus

setkey numbersign underscore

:: no change for equal

:: no change for plus

setkey a q

setkey A Q

setkey z w

setkey Z W

setkey caret bracketleft

:: no equivalent for diaresis => we keep the US braceleft

setkey dollar bracketright

:: no equivalent for pound => we keep the US braceright

setkey q a

setkey Q A

setkey m semicolon

setkey M colon

setkey bracketleft quote

setkey percent doublequote

setkey asterisk backslash

setkey bracketright bar

setkey w z

setkey W Z

setkey comma m

setkey question M

setkey semicolon comma

setkey period less

setkey colon period

setkey slash greater

setkey exclam slash

setkey bar question

#Japan 106

setkey

setkey at bracketleft

setkey doublequote at

setkey ampersand caret

setkey quote ampersand

setkey parenleft asterisk

setkey parenright parenleft

setkey underscore parenright

setkey equal underscore

setkey plus colon

setkey colon quote

setkey asterisk doublequote

setkey bracketleft bracketright

setkey braceleft braceright

setkey bracketright backslash

setkey braceright bar

setkey backslash backquote

setkey tilde plus

setkey caret equal

setkey backquote braceleft

setkey bar tilde

# to set a german keyboard use these setkey commands before the first title command

setkey

setkey yz

setkey zy

setkey YZ

setkey ZY

setkey equal parenright

setkey parenright parenleft

setkey parenleft asterisk

setkey doublequote at

setkey plus bracket right

setkey minus slash

setkey slash ampersand

setkey ampersand percent

setkey percent caret

setkey underscore question

setkey question underscore

setkey semicolon less

setkey less number sign

setkey number sign backslash

setkey colon greater

setkey greater bar

setkey asterisk braceright

# set AZERTY ketyboard

setkey

setkey a q

setkey A Q

setkey z w

setkey Z W

setkey q a

setkey Q A

setkey m semicolon

setkey M colon

setkey w z

setkey W Z

setkey comma m

setkey question M

setkey semicolon comma

setkey period less

setkey colon period

setkey slash greater

setkey exclam slash

setkey dollar bracketright

setkey asterisk backslash

setkey percent doublequote

setkey ampersand 1

setkey 1 exclam

setkey tilde 2

setkey 2 at

setkey doublequote 3

setkey 3 numbersign

setkey quote 4

setkey 4 dollar

setkey parenleft 5

setkey 5 percent

setkey minus 6

setkey 6 caret

setkey backquote 7

setkey 7 ampersand

setkey underscore 8

setkey 8 asterisk

setkey caret 9

setkey 9 parenleft

setkey at 0

setkey 0 parenright

setkey parenright minus

setkey less backquote

setkey greater tilde

setkey numbersign braceright

setkey backslash question

setkey bracketright braceleft

setkey braceleft quote

setkey braceright underscore

#QWERTZ keyboard

setkey

setkey y z

setkey z y

setkey Y Z

setkey Z Y

setkey equal parenright

setkey parenright parenleft

setkey parenleft asterisk

setkey doublequote at

setkey backquote equal

setkey plus bracketright

setkey minus slash

setkey slash ampersand

setkey ampersand percent

setkey percent caret

setkey underscore question

setkey question underscore

setkey semicolon less

setkey less numbersign

setkey numbersign backslash

setkey colon greater

setkey greater bar

setkey asterisk braceright

setkey caret backquote

setkey backslash minus

# ensure not in debug=2 mode or gfxmenu will need two key presses!

debug 1

gfxmenu /message

color black/cyan yellow/cyan

timeout 1

default 0

# line below will ensure the gfxmenu is always loaded even after an error

configfile (bd)/menu.lst

# if booting from a USB Flash drive get the UUID like this

debug 1

uuid (bd) > (md)0x220+1

cat --skip=18 --length=9 (md)0x220+1 | set UUID=

# if booting from HDD use --length=16

echo UUID of boot device is %UUID%

# Ignore boot device and boot to Windows XP, Vista, 7 or 8 from the internal hard disk

# This works by mapping the boot device (bd) which may have bootmgr or ntldr on it, to a virtual memory drive so that files on it are not found by the find command

title Boot to Windows from an internal hard disk

map --mem (md)+8 (bd)

map --hook

find --set-root --ignore-floppies --ignore-cd /bootmgr || find --set-root --ignore-floppies --ignore-cd /ntldr

map (bd) (bd)

map --rehook

chainloader /bootmgr || chainloader /ntldr

#This entry sends an ESC character which can be used to exit from the GFXMenu back to the grub4dos text menu (or the user can just press ESC instead)

#The file esc.txt must exist and contain the ESC character (0x1b or 27 or 033 octal) - the esc.txt file is in Beta Downloads section if you want it!

title grub4dos menu

cat /esc.txt && clear

title List partitions

clear

cat (hd0,0)+1 > (md)800+1 && parttype (hd0,0) && echo Contents of (hd0,0): && ls (hd0,0)/ && echo && echo --------

cat (hd0,1)+1 > (md)800+1 && parttype (hd0,1) && echo Contents of (hd0,1): && ls (hd0,1)/ && echo && echo --------

cat (hd0,2)+1 > (md)800+1 && parttype (hd0,2) && echo Contents of (hd0,2): && ls (hd0,2)/ && echo && echo --------

cat (hd0,3)+1 > (md)800+1 && parttype (hd0,3) && echo Contents of (hd0,3): && ls (hd0,3)/ && echo && echo --------

cat (hd0,4)+1 > (md)800+1 && parttype (hd0,4) && echo Contents of (hd0,4): && ls (hd0,4)/ && echo && echo --------

cat (hd1,0)+1 > (md)800+1 && parttype (hd1,0) && echo Contents of (hd1,0): && ls (hd1,0)/ && echo && echo --------

cat (hd1,1)+1 > (md)800+1 && parttype (hd1,1) && echo Contents of (hd1,1): && ls (hd1,1)/ && echo && echo --------

cat (hd1,2)+1 > (md)800+1 && parttype (hd1,2) && echo Contents of (hd1,2): && ls (hd1,2)/ && echo && echo --------

cat (hd1,3)+1 > (md)800+1 && parttype (hd1,3) && echo Contents of (hd1,3): && ls (hd1,3)/ && echo && echo --------

cat (hd1,4)+1 > (md)800+1 && parttype (hd1,4) && echo Contents of (hd1,4): && ls (hd1,4)/ && echo && echo --------

echo

pause --wait=10 Please check available partitions...

configfile (bd)/menu.lst

title Reboot

reboot

title Switch Off

halt

#hotkey and autonumber example

color white/blue

write --bytes=2 0x8274 0x2001

## run hotkey once to enable hotkey.

/hotkey

## show this menu only if /ntldr can be found

iftitle [find /ntldr] ^Ctrl+F1 Press Ctrl+F1 to boot /ntldr

find --set-root /ntldr

chainloader /ntldr

# Check this CD/USB drive is not too old - see Tutorial #71 for details

# Usage: /checkdate.g4b <Release Year> <Release Month> <Release DayOfMonth> <ExpiresInDays> [<SILENT>]

/checkdate.g4b 2012 12 3 2

pause

if NOT "%CHECKDATE%"=="OK" reboot

#Boot using the original backup MBR sector (copied to LBA1 by grub4dos on install)

#This will boot the system as it would before grub4dos was installed

title Normal Windows Boot

rootnoverify (hd0)

chainloader (hd0)1+1

#this assumes you have booted from a USB drive and you want to boot from the hard disk

title Boot from 1st Hard Disk \nBoot from MBR of first hard disk

map (hd0) (hd1)

map (hd1) (hd0)

map --hook

chainloader (hd0)+1

rootnoverify (hd0)

title FreeDOS

find --set-root /kernel.sys

chainloader /kernel.sys

title MSDOS

find --set-root /io.sys

chainloader /io.sys

title FreeDOS (AS HDD)

map (hd0) (hd1)

map (hd1) (hd0)

map --hook

rootnoverify (hd1,0)

chainloader /kernel.sys

title FreeDOS (AS FLOPPY)

map (hd0,0)+1 (fd0)

map (hd0) (hd1)

map (hd1) (hd0)

map --hook

chainloader (fd0)/kernel.sys

rootnoverify (fd0)

map --floppies=1

title MS-DOS (AS HDD)

rootnoverify (hd0,0)

chainloader (hd0,0)/io.sys

title Always boot from USB to MS-DOS AS FLOPPY DISK A:

checkrange 0x80 read 0x8280 && map (hd0,0)+1 (fd0)

checkrange 0x80 read 0x8280 && map (hd1) (hd0)

checkrange 0x80 read 0x8280 && map --hook

ls (fd0)/io.sys && clear && pause --wait=1 /IO.SYS found on floppy disk

ls (fd0)/io.sys || pause --wait=3 /IO.SYS not found on floppy disk

ls (fd0)/io.sys && chainloader (fd0)/io.sys

ls (fd0)/io.sys && rootnoverify (fd0)

ls (fd0)/io.sys && map --floppies=1

ls (fd0)/io.sys && map --harddrives=1

clear

boot

title MS-DOS (AS FLOPPY) AND HDD as HDD0

map (hd0,0)+1 (fd0)

# map the first partition of the hard disk as a floppy disk

map (hd0) (hd32)

# map the UFD as a virtual cd

map (hd1) (hd0)

# map the real hard disk as hard disk 0

map --hook

# hook Int13 interrupts so all map changes take affect

chainloader (fd0)/io.sys

# load the io.sys code into memory from the floppy disk (now ufd is fd0)

rootnoverify (fd0)

# set the file root as the floppy disk

map --floppies=1

map --harddrives=1

# Tweak BIOS device numbers so DOS sees 1 floppy and 1 hd

title MS-DOS (AS FLOPPY) AND HDD as HDD0 (no comments)

map (hd0,0)+1 (fd0)

map (hd0) (hd32)

map (hd1) (hd0)

map --hook

chainloader (fd0)/io.sys

rootnoverify (fd0)

map --floppies=1

map --harddrives=1

#boot from floppy image with internal hdd as hd0 (no other hdds) (use ImDisk to create a large floppy .ima file)

title Install Win98\n Install Win98 using large .ima file

map /Win98_SE.ima (fd0)

map --hook

set A=

if exist (fd0)/IO.SYS set A=1

if exist (fd0)/KERNEL.SYS set A=1

if not exist A set /p A=ERROR: No DOS boot files found in .ima file! && chainloader /grldr

map (hd1) (hd0)

map --hook

#set just one HDD and one floppy

map --harddrives=1

map --floppies=1

root (fd0)

chainloader /IO.SYS || chainloader /KERNEL.SYS

# http://www.partition-saving.com/

title savepart.iso

# map the iso file as a virtual cd

map /savepart.iso (0xff)

# hook the int 13 interrupt so the BIOS sees it as a CD

map --hook

# set the root path to the new virtual CD

root (0xff)

# boot from the CD

chainloader (0xff)

title spartbdk.img

# map the 1.44MB floppy image as fd0

map /spartbdk.img (fd0)

map --hook

root (fd0)

# load the freedos kernel.sys as the boot file

chainloader /kernel.sys

# Use SHIFT to boot linux in safe mode

title Run Linux\nPress SHIFT+ENTER for safe mode

/bios int=0x16 eax=0x00000200 > (md)0x300+1 && cat --skip=12 --length=2 (md)0x300+1 | set /a n=0x > nul

set /a n=%n% & 0x03 > nul && if %n%>=1 echo SHIFT PRESSED!

#LShift=01,RShift=02,CTRL=04,ALT=08,SCROLL=10,NUM=20,CAPS=40,INS=80

#set /a n=%n% & 0x04 > nul && if %n%>=1 echo CTRL PRESSED!

set sf=

if %n%>=1 set sf=acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp

kernel /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper %sf% splash

initrd /casper/initrd.img

title WinPe v2

map /bootmgr (rd)

chainloader (rd)+1

root ()

;Note: make sure the 'cheat code' fromusb is present and also the bootfromiso path to the iso file on the USB drive starts with a forward slash /

;The ISO filename needs to be 8.3 and is case sensitive too!

title PCLinuxOS LiveCD \n * Boot direct from ISO file

map --unhook

map --unmap=0:0xff

find --set-root --ignore-floppies /pclos.iso

map --heads=0 --sectors-per-track=0 /pclos.iso (0xff)

map --hook

root (0xff)

kernel (0xff)/isolinux/vmlinuz fromusb bootfromiso=/pclos.iso livecd=livecd root=/dev/rd/3 acpi=on vga=788 keyb=en vmalloc=256M edd=off

initrd (0xff)/isolinux/initrd.gz

title BackTrack 4 Final LiveCD (extracted ISO contents to bt4 folder)

find --set-root /bt4/boot/vmlinuz

kernel /bt4/boot/vmlinuz BOOT=/bt4/casper boot=/bt4/casper nopersistent rw quiet vga=0x315

initrd /bt4/boot/initrd.gz

title MEMTEST86+

find --set-root /mt410.iso

map /mt410.iso (hd32)

map --hook

root (hd32)

chainloader (hd32)

#This method of running memtest86+ works on more PCs than the previous one

title memtest.img (memtest.img obtained from ISO)

find --set-root /memtest.img

map /memtest.img (fd0)

map --hook

chainloader (fd0)+1

rootnoverify (fd0)

map --floppies=1

title memtest86+ (bin file)

find --set-root /memtest.bin

kernel /memtest.bin

# USB Boot -> Fat32 Formatted

title Norton Ghost 15 (hd32)

find --set-root /iso/Ghost15.iso

map /iso/Ghost15.iso (hd32)

map --hook

root (hd32)

chainloader /BOOTMGR

title Ultimate Boot CD (UBCD) v5.0 final\nthis is the 14 May 2010 edition,its an all in one Free Bootable CD for IT Pros, the cd consolidate as many diagnostic tools as possible into one bootable CD.

find --set-root /ubcd50.iso

map /ubcd50.iso (hd32)

map --hook

root (hd32)

chainloader (hd32)

title Ultimate Boot CD (UBCD) v5.11 \nthis is the August 2011 edition,its an all in one Free Bootable CD for IT Pros, the cd consolidate as many diagnostic tools as possible into one bootable CD.

find --set-root /ubcd511.iso

map /ubcd511.iso (hd32)

map --hook

root (hd32)

chainloader (hd32)

# only about 2MB is saved by using 7zip to compress the iso to a .gz file

title Hirens Boot CD 13.1 using firadisk \nBoot to Hirens Boot CD in RAM

find --set-root --ignore-floppies --ignore-cd /HirensBCD.13.1.iso.gz

map --mem /firadisk.gz (fd0)

map --mem /HirensBCD.13.1.iso.gz (0xff)

map --hook

root (0xff)

chainloader (0xff)

#iPXE boot - see the iPXE Tutorial for details

title ipxe

map /ISO/ipxe.iso (0xff) || map --mem /ISO/ipxe.iso (0xff)

map --hook

root (0xff)

chainloader (0xff)

# ---- GPARTED ---

title 1 GParted Live (0.8.1-3)

find --set-root --ignore-floppies /live/vmlinuz

kernel /live/vmlinuz boot=live config noswap noprompt ip=frommedia nosplash

initrd /live/initrd.img

title 2 GParted Live (0.8.1-3) ToRAM

find --set-root --ignore-floppies /live/vmlinuz

kernel /live/vmlinuz boot=live config noswap noprompt toram=filesystem.squashfs ip=frommedia nosplash

initrd /live/initrd.img

title 3 GParted Live (0.8.1-3) without framebuffer

find --set-root --ignore-floppies /live/vmlinuz

kernel /live/vmlinuz boot=live config noswap noprompt ip=frommedia nomodeset vga=normal nosplash

initrd /live/initrd.img

title 4 GParted Live (0.8.1-3) failsafe

find --set-root --ignore-floppies /live/vmlinuz

kernel /live/vmlinuz boot=live config noswap noprompt acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp ip=frommedia nomodeset vga=normal nosplash

initrd /live/initrd.img

#Note: if using FAT filesystem, the findiso pathname is CaSeSeNsItIvE!

# http://sourceforge.net/projects/gparted/files/latest/download

title gparted 11.0 live from ISO

find --set-root /gparted-live-0.11.0-10.iso

map /gparted-live-0.11.0-10.iso (0xff) || map --mem /gparted-live-0.11.0-10.iso (0xff)

map --hook

root (0xff)

kernel /live/vmlinuz boot=live config union=aufs noswap noprompt vga=788 ip=frommedia findiso= /gparted-live-0.11.0-10.iso toram=filesystem.squashfs

initrd /live/initrd.img

#Note: if using FAT filesystem, the findiso pathname is CaSeSeNsItIvE!

# http://sourceforge.net/projects/gparted/files/latest/download

title gparted 0.12.1-5 live from ISO

find --set-root /gparted-live-0.12.1-5.iso

map /gparted-live-0.12.1-5.iso (0xff) || map --mem /gparted-live-0.12.1-5.iso (0xff)

map --hook

root (0xff)

kernel /live/vmlinuz boot=live config ip=frommedia findiso=/gparted-live-0.12.1-5.iso

initrd /live/initrd.img

# for failsafe add ...

#noapic noapm nodma nomce nolapic nomodeset nosmp vga=normal

# -----

# http://hdt-project.org/wiki/hdt-0.5.0#Downloads - examine the hardware PCIID's etc. in a system (v small and quick!)

title HDT (Hardware Detection Tool\nhdt-project.org\nType MENU for a GUI menu

map /hdt-0.5.0.iso (0xff)

map --hook

root (0xff)

chainloader (0xff)

#You must first copy the /slax folder from the ISO file and place it on your USB pen

title slax 6.1.2

map /iso/slax-6.1.2.iso (0xff) || map --mem /iso/slax-6.1.2.iso (0xff)

map --hook

root (0xff)

kernel /boot/vmlinuz from=/iso/slax-6.1.2.iso ramdisk_size=6666 root=/dev/ram0 rw

initrd /boot/initrd.gz

title Kasperksy AV 2010 Rescue.iso

map /rescue/rescue.iso (0xff) || --mem /rescue/rescue.iso (0xff)

map --hook

root (0xff)

chainloader (0xff)

title BartPE (from \MININT)

find --set-root /minint/SETUPLDR.BIN

chainloader /minint/SETUPLDR.BIN

title SeaTools ISO

map /SeaToolsDOS223ALL.ISO (0xff)

map --hook

map (0xff)/seatools.ima (fd0)

map --hook

root (fd0)

chainloader /kernel.sys

# boot from the .iso file (160MB) or use 7Zip to compress it to a .gz file (68MB)

title BartPE ISO using firadisk \nBoot to BartPE in RAM

find --set-root --ignore-floppies --ignore-cd /Bartpe.iso

map --mem /firadisk.gz (fd0)

map --mem /Bartpe.iso (0xff)

map --hook

root (0xff)

chainloader (0xff)

title DSLinux ISO

find --set-root /dsl4410.iso

map /dsl4410.iso (hd32)

map --hook

root (hd32)

chainloader (hd32)

# boot knoppix from ISO file (no need to modify ISO with 6.7+)

# works with iso in root or subfolder (thanks to cdob from reboot.pro for workaround for subfolder!)

# ISO boot discussion at http://reboot.pro/16252/

# iso path and filename are Case Sensitive!!!

# Knoppix cheat codes listed at http://www.pendrivelinux.com/knoppix-cheatcodes/

# Set a unique variable (e.g. K1109) in each iftitle line

iftitle [if exist /_ISO/ ADRIANE-KNOPPIX_V6.7.1CD-2011-09-14-EN.iso set K1109=/_ISO/ ADRIANE-KNOPPIX_V6.7.1CD-2011-09-14-EN.iso ] Boot %K1109%

set ISO=%K1109%

ls %ISO% > nul || find --set-root --devices=hf %ISO%

map %ISO% (0xff) || echo %ISO% not contiguous - so need to load it all into memory... && map --mem %ISO% (0xff)

map --hook

root (0xff)

kernel /boot/isolinux/linux bootfrom=/./%ISO% noeject noprompt ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime

initrd /boot/isolinux/minirt.gz

iftitle [if exist /KNOPPIX_V7.0.4CD-2012-08-20-EN.iso] Boot KNOPPIX

set ISO=/KNOPPIX_V7.0.4CD-2012-08-20-EN.iso

ls %ISO% > nul || find --set-root --devices=hf %ISO%

map %ISO% (0xff) || echo %ISO% not contiguous - so need to load it all into memory... && map --mem %ISO% (0xff)

map --hook

root (0xff)

kernel /boot/isolinux/linux bootfrom=/./%ISO% noeject noprompt ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime

initrd /boot/isolinux/minirt.gz

title KNOPPIX\nAt boot prompt type - knoppix bootfrom=/dev/hda0/KNOPPIX155.iso

map /KNOPPIX511.iso (hd32) || map --mem /KNOPPIX511.iso (hd32)

map --hook

root (hd32)

chainloader (hd32)

title Knoppix 7

#http://www.knopper.net/knoppix-info/index-en.html

set lang=en

set ISOfile=/images/KNOPPIX_V7.0.5.iso

cat --length=0 %ISOfile% > nul || find --set-root --devices=hf %ISOfile%

map %ISOfile% (0xff)

map --hook

root (0xff)

kernel /boot/isolinux/linux bootfrom=/dev/*%ISOfile% noeject noprompt ramdisk_size=100000 lang=%lang% vt.default_utf8=0 apm=power-off nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=localtime

initrd /boot/isolinux/minirt.gz

title KNOPPIX 6.2.1\nNote: Must use modified initrd.gz to boot from ISO - Note: version specific - does not work with 6.7.0!

#http://knol.google.com/k/yoshihide-nomura/how-to-boot-knoppix-directly-from-iso/2vzr3sm0dzndc/1#

#http://www.knoppix.net/wiki/Cheat_Codes

#http://archive.yoshimov.com/knoppix/initrd-mod-6.2.1.gz has modified initrd file

#iso file and modifed initrd placed in ISO folder in this example

find --set-root /iso/KNOPPIX_V6.2.1CD-2010-01-31-EN.iso

map /iso/KNOPPIX_V6.2.1CD-2010-01-31-EN.iso (hd32) || map --mem /iso/KNOPPIX_V6.2.1CD-2010-01-31-EN.iso (hd32)

map --hook

root (hd32)

echo "Loading kernel.."

kernel /boot/isolinux/linux ramdisk_size=100000 lang=en vt.default_utf8=0 apm=power-off vga=791 nomce noeject noprompt quiet loglevel=0 tz=localtime fromiso=iso/KNOPPIX_V6.2.1CD-2010-01-31-EN.iso edd=off --

echo "Loading modified initrd downloaded from http://archive.yoshimov.com/knoppix/initrd-mod-6.2.1.gz"

initrd (bd)/iso/initrd-mod-6.2.1.gz || initrd (hd0,0)/iso/initrd-6.2.1.gz

# Run from hd0,2 partition as flat file installation - Knoppix will find correct partition

title Boot Knoppix v7.6\n Run KNOPPIX

root (hd0,2)/multiboot/KNOPPIX_V7.6.1DVD-2016-01-16-EN/boot/isolinux

kernel /linux knoppix_dir=/multiboot/KNOPPIX_V7.6.1DVD-2016-01-16-EN/KNOPPIX lang=en apm=power-off nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1

initrd /minirt.gz boot

# -- PUPPY LINUX -----

#The following cheat codes have been tried with precise, slacko and tahr and none work!!

#iso_filename=%ISOSCAN% isofrom_system=%ISOSCAN% isoboot=%ISOSCAN% isoloop=%ISOSCAN% img_loop=%ISOSCAN%

#bootfromiso=%ISOSCAN% findiso=%ISOSCAN% fromiso=%ISOSCAN% from=%ISOSCAN%

#isofrom=%UUID%:%ISOSCAN% iso-scan/filename=%ISOSCAN% isofrom_device=/dev/disk/by-uuid/%UUID% isofrom_system=%ISOSCAN%

#iso-scan/filename=%ISOSCAN% isofrom_device=/dev/disk/by-uuid/%UUID% isofrom_system=%ISOSCAN%

#boot from ISO - sqfs file must be extracted to level1 folder (any name of folder - e.g. \fred)

#e.g. \xyzzy\puppy_precise_5.7.1.sfs and puppy will find it - does not work if level2 folder or below (e.g. \xyxxy\fred\xxx.sfs will not work)

#works for FAT32 or NTFS - name of .sfs file must be lower case (extract using 7zip on ISO file)

#many diferent .sfs files can be placed in the same folder for other versions too

title Puppy Precise boot from ISO

map /_ISO/Linux/precise-5.7.1.iso (0xff)

map --hook

root (0xff)

#pmedia can be (nothing) ='auto', or usbhd, satahd, idehd, scsihd, usbflash

kernel /vmlinuz pmedia= psavemark=1

initrd /initrd.gz

# Only the ISO file is required for this menu - 4th ptn on USB drive must be empty!

iftitle [if exist (bd)/_ISO/Linux/precise-5.4.3.iso] Puppy Precise 5.4.3\n Puppy with persistence

partnew (hd0,3) 0x00 (bd)/_ISO/Linux/precise-5.4.3.iso

map (bd)/_ISO/Linux/precise-5.4.3.iso (0xff)

map --hook

root (0xff)

kernel /vmlinuz pmedia=usbflash psavemark=1 fix=fsck

#You need to use pmedia=usbhd if you are booting from a USB HDD.

#kernel /vmlinuz pmedia=usbhd psavemark=1 fix=fsck

initrd /initrd.gz

# -- CLONEZILLA ---

title CLONEZILLA (wait 2-3 minutes and hit Enter twice!)

;long wait at splash screen but it works!

kernel /live/vmlinuz1 locale=us boot=live persistent

initrd /live/initrd1.img

title CLONEZILLA hd0<->hd1 (wait 2-3 minutes and hit Enter twice!)

;long wait at splash screen but it works!

map (hd0) (hd1)

map (hd1) (hd0)

kernel /live/vmlinuz1 locale=us boot=live persistent

initrd /live/initrd1.img

title Parted Magic /ISO/pmagic_2013_02_28.iso (booting the kernel)

map /ISO/pmagic_2013_02_28.iso (0xff)

map --hook

root (0xff)

kernel /pmagic/bzImage edd=off load_ramdisk=1 prompt_ramdisk=0 rw vga=normal sleep=10 loglevel=0 max_loop=256 vmalloc=384MiB keymap=us iso_filename=/ISO/pmagic_2013_02_28.iso

initrd /pmagic/initrd.img

title pmagic_2012_06_07.iso

#name must be in pmagic-yyyy_mm_dd.iso format and in root folder or will not find the .sqfs file

find --set-root /pmagic_2012_06_07.iso

map --heads=0 --sectors-per-track=0 /pmagic_2012_06_07.iso (0xff)

map --hook

root (0xff)

chainloader (0xff)

title Parted Magic 4.10 ISO

find --set-root /pmagic.iso

map /pmagic.iso (hd32)

map --hook

root (hd32)

kernel /pmagic/bzImage noapic load_ramdisk=1 prompt_ramdisk=0 rw vga=791 sleep=10 loglevel=0 keymap=uk iso_filename=/pmagic.iso

initrd /pmagic/initramfs

map --unmap=0:0xff

title Parted Magic 5.2 (direct memory mapping and booting the kernel)

find --set-root /pm52.iso

map --mem /pm52.iso (hd32)

map --hook

root (hd32)

kernel /pmagic/bzImage noapic load_ramdisk=1 prompt_ramdisk=0 rw vga=791 sleep=10 loglevel=0 keymap=us iso_filename=/pm52.iso

initrd /pmagic/initramfs

map --unmap=0:0xff

title Acronis True Image 2009 / 2013

find --set-root /acronis.iso

map /acronis.iso (hd32)

map --hook

root (hd32)

chainloader (hd32)

title Acronis Recovery 2013

kernel /Recovery\ Manager/kernel.dat quiet media_for_linux vga=ask

initrd /Recovery\ Manager/ramdisk.dat

title Windows Password reset

find --set-root /cd100627.iso

map /cd100627.iso (0xff)

map --hook

chainloader (0xff)

title OphCrack Password Cracker XP 2.3.1

find --set-root /ophcrack_xp/boot/bzImage

kernel /ophcrack_xp/boot/bzImage rw root=/dev/null vga=normal ophcrack=lowram lang=C kmap=uk screen=1024x768x16 autologin

initrd /ophcrack_xp/boot/rootfs.gz

title OphCrack Password Cracker Vista 2.3.1

find --set-root /ophcrack_vista/boot/bzImage

kernel /ophcrack_vista/boot/bzImage rw root=/dev/null vga=normal ophcrack=lowram lang=C kmap=uk screen=1024x768x16 autologin

initrd /ophcrack_vista/boot/rootfs.gz

#name must be in pmagic-x.y.iso format or will not find sqfs file

title PC CMOS Cleaner and Parted Magic 5.7 ISO

find --set-root /pmagic-5.7.iso

map --heads=0 --sectors-per-track=0 /pmagic-5.7.iso (hd32)

map --hook

root (hd32)

chainloader (hd32)

title Slitaz 4 RC1 Live

find --set-root /slitaz-4.0-RC1.iso

map --heads=0 --sectors-per-track=0 /slitaz-4.0-RC1.iso (0xff)

map --hook

root (0xff)

chainloader /boot/isolinux/isolinux.bin

title SliTaz Cooking (may be no kbd in GUI?)

find --set-root /slitaz-cooking.iso

map --heads=0 --sectors-per-track=0 /slitaz-cooking.iso (0xff)

map --hook

root (0xff)

kernel /boot/bzImage rw root=/dev/null

#vga=normal lang=C kmap=uk screen=1024x768x16 autologin

initrd /boot/rootfs.gz

title SliTaz 3.0

find --set-root /slitaz-3.0.iso

map --heads=0 --sectors-per-track=0 /slitaz-3.0.iso (0xff)

map --hook

root (0xff)

kernel /boot/bzImage rw root=/dev/null

#vga=normal lang=C kmap=uk screen=1024x768x16 autologin

initrd /boot/rootfs.gz

# - - - - - - - - - #

# GENERIC ANY LINUX BOOT FROM ISO TECHNIQUE!

# See Tutorial 93 for details

# This menu can be used for to boot any linux iso file

# It is especially useful if your boot drive is NTFS but linux does not understand NTFS once it boots and so cannot boot further

# WARNING: permanently alters the boot device's partition table (adds a 4th ptn entry)!

# Use with care as it will obliterate ptn 4 on the boot device if it already exists!

# see http://reboot.pro/topic/9916-grub4dos-isohybrided/page-2#entry88531 for details

iftitle [if exist /tails-i386-0.15.iso] Tails (boot from ISO)

set ISO=tails-i386-0.15.iso

find --set-root %ISO%

parttype (hd0,3) | set check=

set check=%check:~-5,4%

if %check%==0x00 partnew (hd0,3) 0x00 %ISO%

if NOT %check%==0x00 echo ERROR: Partion Table entry 4 already exists! && pause --wait=3 && configfile /menu.lst

map /%ISO% (0xff)

echo -e \r\n

map --hook

root (0xff)

chainloader (0xff)

#some examples not using iftitle so they will always be listed even if the ISO file does not exist!

title raring-dvd-i386.iso\nEdubuntu 13.04 Alpha 1 Test Build

set ISO=/raring-dvd-i386.iso

find --set-root %ISO%

parttype (hd0,3) | set check=

set check=%check:~-5,4%

if %check%==0x00 partnew (hd0,3) 0x00 %ISO%

if NOT %check%==0x00 echo ERROR: Partion Table entry 4 already exists! && pause --wait=3 && configfile /menu.lst

map %ISO% (0xff)

map --hook

root (0xff)

chainloader (0xff)

title systemrescuecd-x86-3.1.2.iso\nSystemRescueCD

set ISO=/systemrescuecd-x86-3.1.2.iso

find --set-root %ISO%

parttype (hd0,3) | set check=

set check=%check:~-5,4%

if %check%==0x00 partnew (hd0,3) 0x00 %ISO%

if NOT %check%==0x00 echo ERROR: Partion Table entry 4 already exists! && pause --wait=3 && configfile /menu.lst

map %ISO% (0xff)

map --hook

root (0xff)

chainloader (0xff)

# - - - - - - - - END OF GENERIC ISO EXAMPLES - - - - - #

#load a gzipped floppy disk image (convert to .gz using gzip or 7Zip)

title MSDOS 6.22 using chainloader from gz file

find --set-root /dos622.ima.gz

map --mem /dos622.ima.gz (fd0)

map --hook

rootnoverify (fd0)

chainloader (fd0)+1

title PLD RescueCD - Linux RCDx86_298.iso\nhttp://rescuecd.pld-linux.org/

find --set-root /RCDx86_298.iso

map /RCDx86_298.iso (hd32)

map --hook

root (hd32)

chainloader (hd32)

# ActiveBootDisk (pe 3.1 based)

# extract the two files _bootDisk.ini and BOOTDISK.KEY from ISO and place in the root of the drive first!

title Active@ Boot Disk 6.5

map /ISO/ActiveBootDisk.ISO (0xff) || map --mem /ISO/ActiveBootDisk.ISO (0xff)

map --hook

root (0xff)

chainloader (0xff) || chainloader (0xff)/BOOTMGR

#Error 43: The BPB hidden_sectors should not be zero for a hard-disk partition boot sector

#See Wonko's post at http://reboot.pro/topic/16429-easy2boot-development-discussion/page-30#entry185771

# This error may be found when attempting to chainload to a partition - e.g. chainloader (hd0,1)+1

# The following code assumes partition 4 is empty/unused

set BOOTPTN=(hd0,1)

debug normal

parttype (hd0,3) | set check=

set check=%check:~-5,4%

#create new ptn4 (also fixes up the BPB hidden sectors in %BOOTPTN%)

if %check%==0x00 partnew (hd0,3) 0x00 %BOOTPTN%

# remove new partition entry

if %check%==0x00 partnew (hd0,3) 0 0 0 0

if NOT %check%==0x00 echo ERROR: Partion Table entry 4 already exists! && pause --wait=3 && configfile /menu.lst

chainloader %BOOTPTN%+0x50

boot

#MEMDISK is not really needed as the built in grub4dos CHAINLOADER command is similar in action and allows for direct drive remapping, However, it is useful in being able to load .zip files which chainloader cannot (chainloader can load .gz compressed files however).

#MEMDISK allows booting legacy operating systems. MEMDISK can boot floppy images, hard disk images and some ISO images see here for details.

#MEMDISK simulates a disk by claiming a chunk of high memory for the disk and a (very small - 2K typical) chunk of low (DOS) memory for the driver itself, then hooking the INT 13h (disk driver) and INT 15h (memory query) BIOS interrupts. The memdisk binary can be obtained from the syslinux project here .

#initrd loads the specified file into the ramdrive (initialise ramdrive)

title Memtest 86+

kernel /memdisk raw

initrd /memtest.img

title MEMTEST86+ iso using memdisk

kernel /memdisk iso

initrd /mt410.iso

#use raw mode (raw access to protected mode)

title MSDOS floppy disk image

kernel /memdisk raw

initrd /dos622.ima

title MSDOS 6.22 using memdisk raw from zip file of floppy disk image (1.44MB image compressed as .zip file)

kernel /memdisk raw

initrd /dos622.zip

title MSDOS 6.22 using memdisk raw from .gz file of floppy disk image (1.44MB image compressed as .gz file)

kernel /memdisk raw

initrd /dos622.ima.gz

# http://www.mepis.org/

# Mount the SimplyMEPIS-1.5G_11.0.12_32.iso file

# Copy the mepis folder to your USB drive

# Copy the boot folder to the inside of the mepis folder

# USB Drive folders:

# /mepis has large mepis file

# /mepis/boot has initrd.gz and vmlinuz

# Use either "root" for user and "root" for password, or "demo" for user and "demo" for password.

title SimpleMEPIS Default

kernel /mepis/boot/vmlinuz vga=788 quiet splash

initrd /mepis/boot/initrd.gz

title SimpleMEPIS AUFS_rw_filesystem\nNothing is stored on the flash drive, all changes are temporary

kernel /mepis/boot/vmlinuz vga=788 quiet splash aufs

initrd /mepis/boot/initrd.gz

# Look for specific BIOS or System type

#0x680 = D000:0 - the start of the DMI and BIOS area

#0x180 = 30000h - the length of the search, so it will finish at F000:FFFFh - i.e. end of BIOS area

#So if the DMI string was 'EeePC' on one system and 'DELL' on another, then use

set SYSTEM=

if "%SYSTEM%"=="" cat --locate=\x45\x65\x65\x50\x43 (md)0x680+0x180 > nul && set SYSTEM=EeePC

if "%SYSTEM%"=="" cat --locate=\x44\x45\x4C (md)0x680+0x180 > nul && set SYSTEM=DELL

<more here>

if "%SYSTEM%"=="" pause --wait=3 ERROR: No BIOS strings found that I recognise! && configfile /menu.lst

echo "%SYSTEM%" found:

# Next line displays the hex string and following bytes for user interest!

cat --hex --length=0x80 --skip=%?% (md)0x680+0x180

if "%SYSTEM%"=="DELL" set MYISO=/dell.iso

if "%SYSTEM%"=="EeePC" set MYISO=/EeePC.iso

<more here>

# now do stuff with the correct ISO!

# check mainboard MAC address - e.g. MAC address is 00:23:54:58:32:6b

cat --locate=\x00\x23\x54\x58\x32\x6b (md)0x680+0x180 || pause --wait=3 WRONG SYSTEM! && halt

# Lock a menu entry to a MAC address (so that this will only work on one system which has MAC address = 00:23:54:58:32:6b!)

# Use SCANBIOH.exe DOS tool from Beta Downloads page to find the correct memory location that contains your MAC address

# You can also use this technique to match against your mainboard serial number or model type

# See http://reboot.pro/14640/page__view__findpost__p__130251 for details.

title Run MSSS only on my EeePC!

#prevent checkrange from printing contents on the screen so it looks neater!

debug off

#check for the MAC address in BIOS RAM area

checkrange 0x58542300 read 0xf0757 && checkrange 0x6b32 calc *0xf075b & 0xffff && echo OK - MAC ADDRESS 00:23:54:58:32:6b FOUND

#if not correct MAC address then reload menu

checkrange 0x58542300 read 0xf0757 || pause --wait=3 INCORRECT MAC ADDRESS! && exit

checkrange 0x6b32 calc *0xf075b & 0xffff || pause --wait=3 INCORRECT MAC ADDRESS! && exit

#now do any commands as normal

find --set-root /MSSS_Media32.iso

map /MSSS_Media32.iso (0xff) || map /MSSS_Media32.iso (0xff)

map --hook

chainloader (0xff)

#Note: if you want to check a byte at any memory location use:

checkrange 0x32 calc *0xf075b & 0xff || pause --wait=3 INCORRECT MAC ADDRESS! && exit

#Note: if you want to check a word at any memory location use:

checkrange 0x6b32 calc *0xf075b & 0xffff || pause --wait=3 INCORRECT MAC ADDRESS! && exit

#Note: if you want to check a 3 bytes at any memory location use:

checkrange 0x066b32 calc *0xf075b & 0xffffff || pause --wait=3 INCORRECT MAC ADDRESS! && exit

#Note: if you want to check a DWORD (4 bytes) at any memory location use:

checkrange 0x05066b32 read 0xf075b || pause --wait=3 INCORRECT MAC ADDRESS! && exit

or

checkrange 0x05066b32 calc *0xf075b & 0xFFFFffff || pause --wait=3 INCORRECT MAC ADDRESS! && exit

checkrange can also be used to check a range of values - e.g. checkrange 0x00:0x10 or checkrange 0x00,0x02,0x04

#is64bit - checks 64bit and PAE status

#returns value bit0=PAE supported, bit1=AMD64/Intel64 supported"

iftitle [checkrange 0,1 is64bit] 32bit system

#(menu here)

iftitle [checkrange 2,3 is64bit] 64bit system

#(menu here)

iftitle [checkrange 1,3 is64bit] PAE system

#(menu here)

iftitle [checkrange 0,1 read 0x82Bc] 32Bit system

#(menu here)

#Example for calc

calc *0x6000=0x8280+4 - put result of adding 0x8280 + 4 into memory at 0x6000

#Norton Bootable Recovery Tool

#The ISO is WinPE 3 based. To make it work, it needs to find the NBRTSTRT.exe file in the root of the drive

#and also you need to copy two folders from inside the ISO to your USB drive, so as well as the ISO file on your USb drive you need:

#

#\NBRTSTRT.exe

#\Sources\DRIVERS

#\Sources\SYMANTEC_NBRT

title NBRT

map /_ISO/NBRT.iso (0xff)

map --hook

chainloader (0xff)

#COMODO RESCUE DISK - antivirus cleaning tool inc. COMODO CLEANING ESSENTIALS

#Copy the contents of the ISO /boot folder to /comodo/boot on the USB drive

splashimage /comodo/boot/grub/SPLASH_X.GZ

title Comodo Rescue Disk 1.1.232326.14

kernel /comodo/boot/bzimage

initrd /comodo/boot/rootfs.gz

title Comodo Rescue Disk 1.1.232326.14

map /comodo_rescue_disk_1.1.232326.14.iso (0xff)

map --hook

root (0xff)

kernel /boot/bzimage

initrd /boot/rootfs.gz

title DaRT70Win764\nMS DART ISO

set MYISO=dartwin70.iso

map /images/%MYISO% (0xff)

map (hd0) (hd1)

map (hd1) (hd0)

map --hook

chainloader (0xff)/BOOTMGR || chainloader (0xff)

Click here to see the 'God-on-a-stick' menu.lst and folder contents for lots more examples of menu.lst entries.

For booting ISOs with persistence see the example .mnu files in the Easy2Boot download.

FAT+NTFS TWO Partition USB Drive

This code will swap over the grub4dos ptn table first two entries to make the NTFS ptn the first ptn (if it is not already)

title set NTFS as 1st partition

debug off

# This always sets the first partition to NTFS (if NTFS+FAT32 in ptn table)

# first get MBR into two areas of memory

dd if=(hd0) of=(md)0x3000+1 count=1

dd if=(hd0) of=(md)0x3100+1 count=1

echo PTN TABLE WAS...

cat --hex --length=32 --skip=446 (md)0x3000+1

#Now overwrite 2nd copy with tables from 1st copy but change the order...

set /A m=*0x6001be

write 0x6201ce %m%

set /A m=*0x6001c2

write 0x6201d2 %m%

set /A m=*0x6001c6

write 0x6201d6 %m%

set /A m=*0x6001ca

write 0x6201da %m%

set /A m=*0x6001ce

write 0x6201be %m%

set /A m=*0x6001d2

write 0x6201c2 %m%

set /A m=*0x6001d6

write 0x6201c6 %m%

set /A m=*0x6001da

write 0x6201ca %m%

echo NEW TABLE WILL BE...

cat --hex --length=32 --skip=446 (md)0x3100+1

# get value of original 1st ptn ID = 7=NTFS

set /A n=*0x6001c2 & 0xff

if /i "%n%"=="0x7" echo 1st ptn entry is already NTFS - NO NEED TO SWAP!

set /A m=*0x6201c2 & 0xff

if not /i "%m%"=="0x7" echo WARNING: NO NTFS FOUND IN 1st OR 2nd PARTITION (1st=%n% 2nd=%m%)!

set ASK=N && echo

if /i "%m%"=="0x7" set /p ASK=OK TO RE-ORDER PTN TABLE AND WRITE MBR TO (hd0) (Y/N)? :

if /i "%m%"=="0x7" if not /i "%ASK%"=="Y" configfile /menu.lst

if /i "%ASK%"=="Y" dd if=(md)0x3100+1 of=(hd0) count=1

if /i "%m%"=="0x7" clear && echo -e \r\nNOW PTN TABLE SET TO...

if /i "%m%"=="0x7" cat --hex --length=0x20 --skip=0x1be (hd0)+1

pause

# Now boot or whatever!

#PROXMOX 4.4

# place ISO and this .mnu file in \_ISO folder.

# vga=791 is required or will get Installation aborted error.

# lvm2root must be set to the E2B USB drive partition which is mapped to the ISO

# Partition 4 table entry will be destroyed and must be empty/unused

iftitle [if exist /ISO/proxmox-ve_4.4-eb2d6f1e-2.iso] proxmox 4.4\n You must enter the correct USB device name.

set ISO=proxmox-ve_4.4-eb2d6f1e-2.iso

#don't echo of values on screen

debug off

#make sure all drives are unmapped as this can change the count

#reset hdcount in BIOS to default

map --unhook

map --unmap=0:0xff

root (bd)

#set number of hard disks in system from BIOS location 475h

set /a HDCNT=*0x475 & 0xff > nul

# cannot install to E2B drive!

if %HDCNT%==1 pause --wait=3 ERROR: No internal hard disk detected && configfile /menu.lst

# add 0x60 so drive 1 = a, drive 2 = b

set /A ldisk=%HDCNT%+0x60 > nul

call echo -e sd\%ldisk:~1,4% | set ldisk=

echo %HDCNT% disks in system including USB drive

echo

echo -e I guess the USB drive will be $[0104]%ldisk%

echo

set /p ldisk=Enter linux device name for USB drive, e.g. sdb or sdc (A=abort, ESC=%ldisk%) :

echo

# must start with sd

if not "%ldisk:~0,2%"=="sd" pause --wait=3 ERROR: Must begin with "sd" && configfile /menu.lst

pause --wait=3 Will use /dev/%ldisk%4 for ISO file

# WARNING: partition 4 MUST be free! The next line overwrites it!

partnew (hd0,3) 0x0 /ISO/%ISO%

map /ISO/%ISO% (0xff)

map --hook

root (0xff)

kernel /boot/linux26 ro ramdisk_size=16777216 lvm2root=/dev/%ldisk%4 vga=791 rw quiet splash=silent

initrd /boot/initrd.img

boot

Example menu to map a disk image to the next available device

title boot from dos image as next available hard disk

find --set-root /DOS.img

map /DOS.img (hd) || map --mem /DOS.img (hd)

map --hook

root (hd-1,0)

chainloader /IO.SYS

clear

#turn off echo of values on screen

debug off

#make sure all drives are unmapped as this can change the count

#reset hdcount in BIOS to default

map --unhook

map --unmap=0:0xff

root (bd)

#set number of hard disks in system from BIOS location 475h

set /a HDCNT=*0x475 & 0xff

set NEWHD=(hd%HDCNT%)

if %HDCNT%>=2 echo %HDCNT% Hard disks in system, next free drive is %NEWHD% && pause --wait=3

title map floppy image as next hd

map --unmap=0:0xff

map --unhook

#set number of hard disks in system from BIOS location 475h

set /a HDCNT=*0x475 & 0xff

set NEWHD=(hd%HDCNT%)

if %HDCNT%>=2 echo %HDCNT% Hard disks in system, next free drive is %NEWHD% && pause --wait=3

echo Mapping /fd002880.ima as %NEWHD%

map /fd002880.ima %NEWHD%

map --hook

root %NEWHD%

ls %NEWHD%/

pause

chainloader %NEWHD%+1

title Map as a new HD from test.ima from PXE root folder

set /a hdn=*0x475 & 0xff

map --mem (pd)/test.ima (hd%hdn%)

map --hook

OR just use:

map --mem (pd)/test.ima (hd)

map --hook

Example to find correct 'devices' switch (using 'fh' to include floppy disks when there is no floppy drive can cause long delays of 5 minutes or more!)

#bit 0 in 410 indicates a boot floppy is present

set /a FLP=*0x410 & 0x01

echo There is a boot floppy present && pause

set dev=h

if %FLP%>=1 set dev=fh && set ignore=--ignore-floppies

find --set-root %ignore% --ignore-cd /ntldr

#alternatively use

find --set-root --devices=%dev% /myfile.iso

#add rest of commands here...