32 - Create a USB drive with multiple Vista/Win7/Server2008 install ISO files in 3 simple steps!

Unique hits hit counter

New (26 April 2011): Windows Repair feature now included (please use new Winiso_ImDisk_32a.zip file in Beta Downloads section)!
New (23 June 2011): Universal menu added which lets the user pick any iso file. Can now have the ISO folder on any hard drive instead of the boot drive.

See also new Tutorial #43 which is similar but neater and uses FiraDisk and does not rely on writeable boot media to pass the ISO filename. Also includes a method of using any Windows installation ISO from a hard disk (see Addendum).

Windows 10 is not supported (requires a recent version of ImDisk).

NOTE: This tutorial has now been superceded by Tutorial #43 - please use Tutorial #43 which uses FiraDisk.


I assume you have a number of MS Vista\Win7\SVR2K8 or later install ISOs (or DVDs from which you can make ISOs) and you want to put them all on one single USB Flash drive (or you can use a USB hard drive - but see *Note below) so that you can install any OS onto the target system's hard disk by booting from the USB drive.

Well, it's as easy as 1-2-3!

Watch the YouTube video here >>>>>
Note: this video shows MS-DOS FAT32 being used.
Any choice will work as grub4dos will not use the OS boot code.

You can download some Windows 7 ISOs from here.

Workaround if using a USB Hard Disk as the boot device

*Note: Read this section only if you are going to use a USB hard disk drive instead of a USB Flash drive ...

USB hard drives usually appear in Windows Explorer as 'Fixed Disks' and not as Removable Disks, The method described below only works if a Removable disk contains the AutoUnattend.xml file. However the method below can still be made to work but you will have to type a few commands each time (or have a spare USB Flash drive handy) because the AutoUnattend.xml file is not recognised by Windows PE if it is on a fixed disk and this procedure only works if the autounattend.xml is detected on a removable drive!

Method 1: If the Windows Setup cannot find a source 'DVD' and asks you to install a driver, you will need to:
  • Once Setup has loaded - type SHIFT+F10 (hold down the SHIFT key and press and release the F10 key) - a command prompt console window should open
  • Find which drive letter the USB hard disk is on by typing 'dir C:' {Enter} then dir d: {Enter} etc. until the USB hard drive is listed - let us assume it is C: for now
  • Type C: {Enter} where C is the letter of your USB hard disk
  • Type IMDISK\LOADISO.CMD - a blue command prompt window should open and then the blue and black windows should close.
Now try running Setup again from the beginning (DO NOT REBOOT, just use Back/Cancel buttons to go back to the first screen) - this time it should find the Windows DVD as IMDISK will have loaded it as a Virtual DVD.

Method 2: An easier alternative is to use a small USB Flash Drive in addition to your USB bootable hard disk. You will just need to copy the Autounattend.xml file to the flash drive (it can also have any other files you like on it, as long as it has the AutoUnattend.xml in the top level/root). The USB hard disk drive containing all your ISO files should be made as detailed in the instructions below. Then boot from USB HDD with the USB flash drive also present in the system (or, just as the WinPE horizontal loading bar appears, insert the USB Flash drive before WinPE is fully loaded). WinPE should then see AutoUnattend.xml on your removable USB flash drive and load ImDisk from your USB hard disk and map the ISO file that you wanted. In the case of Windows 7 SP1 Enterprise Edition, the AutoUnattend.xml is loaded and ImDisk is run after you have selected your locale (country, etc.) and then clicked on 'Install now'. Each time the large 'Setup is Starting' text appears the AutoUnattend.xml is found on the flash drive and is automatically executed.

One method for quick experimental OS installation is to have a test PC which has two or more partitions on the one hard drive (or more than one hard drive). You can have the \ISO folder containing all your ISO files on one partition of the hard drive. Create a USB flash drive as below and boot from it. You can then install any SKU of Windows to the 2nd hard disk partition by booting from the USB flash drive, the ISOs on the hard disk first partition will be automatically found and used. This is a very fast way to re-install any Windows OS.


Note: see also the new 'Universal' method at the bottom of this page - no menu needs to be edited at all - you just drop your ISO files into the \ISO folder!. The menu lists all the ISO files and the user selects which one they want.

1. Download the file WINISO_IMDISK_32a.ZIP (new as of 2011-6-23 !!!) from the Beta Downloads - Tutorials section and extract the contents to a folder on your office system hard disk - say C:\WINDOWS_ISOS.


\AutoUnattend.xml (must be in root of a REMOVABLE drive - i.e. a drive that appears as 'Devices with Removable Storage' and not under 'Hard Disk Drive' disk under Windows 7 Explorer)
\menu.lst (also must be in root of USB drive)
\ImDisk folder (folder located in root of USB drive)

2. Now copy over your ISO files to the ISO subfolder C:\WINDOWS_ISOS\ISO which you will need to create and then edit the menu.lst file afterwards so that the location of all your ISO files matches the menu entries.

Note that you will need to alter the highlighted portions below to match your ISO files (this example assumes you store your ISO files in the \ISO folder on the USB drive):

PLEASE NOTE: The line beginning with 'write' should not contain any device name, it only should contain a path, the code in LOADISO.cmd will determine which drive the ISO is on by searching all drive letters for it - even if the ISO is on another hard drive or DVD drive it will find the ISO file, so the ISO file does not even have to be on the same USB drive!

title Install Windows 7 64-bit Enterprise Edition\nRun the Windows install DVD to install a copy of Windows to your hard disk
find --set-root /ImDisk/myiso.cmd
dd if=()/ImDisk/au.xml of=()/AutoUnattend.xml
dd if=()/ImDisk/cr.txt of=()/ImDisk/myiso.cmd
write ()/ImDIsk/myiso.cmd SET MYISO=\\iso\\en_windows_7_enterprise_with_sp1_x64_dvd_620201.iso\r\n
map /iso/en_windows_7_enterprise_with_sp1_x64_dvd_620201.iso (0xff)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (0xff)

title Repair Windows 7 64-bit Enterprise Edition\nRepair Windows on your hard disk
find --set-root /ImDisk/myiso.cmd
dd if=()/ImDisk/spaces.txt of=()/AutoUnattend.xml
map /iso/en_windows_7_enterprise_with_sp1_x64_dvd_620201.iso (0xff)
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (0xff)

#Add more menu items here for more ISO files by repeating the two menus above.

title Boot from 1st Hard Disk \nBoot from MBR of first hard disk and remove the USB drive
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
chainloader (hd0)+1
rootnoverify (hd0)

N.B. The path in a grub4dos menu uses a forward slash / and not the Windows backslash \ character but for the SET MYISO line we need to use \\ to specify a windows path.

3. Prepare the USB drive using RMPrepUSB (if you don't already have one - if you do then you need to have the grub4dos bootloader installed - RMPrepUSB can just add the grub4dos bootloader for you):

Run RMPrepUSB - if you have a USB Flash dirve, make sure it is listed as a Removable Drive and not a Fixed Disk.
To wipe and format the USB drive (optional) - set the following options in RMPrepUSB:
1. MAX
2. (any volume name you like!)
3. WinPE v2/v3 (or DOS or FreeDOS or XP)
4. FAT32 or NTFS (or FAT16 but it has a 2GB limit) and also select the Boot as HDD option
5. Tick Copy OS Files box and set the Copy Folder to C:\WINDOWS_ISOS (note: we want to COPY the files in the folder NOT extract from a file)
6. Click Prepare Drive to format the drive and copy the files over

NOTE: Whether you already have an existing grub4dos USB drive or have just formatted one as detailed above, you need to install the latest version of grub4dos as follows:

Now click on Install grub4dos and choose Yes for PBR and hit Enter to copy across the grldr file. You need the correct grub4dos grldr file as this supports some newer grub4dos commands.

Note: Vikram has found that this method does not work if you are using plop to boot from the USB drive. This is because plop does not support writes to disk and so the write to \ImDisk\myiso.cmd will not work.

That's it. Now go boot it and install Windows on something - you should see the blue Windows Command Shell window flash up briefly.

Note: you must use the USB drive on a real system - an emulated\virtual one may not work - e.g. QEMU won't work as writes are disabled by default in QEMU on PhysicalDrives so the 'write' command will not actually work! Also WinPE needs to see a removable drive containing the AutoUnattend.xml file so an emulator usually won't work.

Once your OS has installed, if the system reboots back to the USB drive again, just use the last menu item to boot from the hard disk (or just remove the USB drive and reboot).

Note: To add a standard XP install ISO to your USB drive, see Tutorial #30.


If any of the commands fail, try adding a pause command after each line to see which line gives the error:

title Install Windows 7 64-bit Enterprise Edition\nRun the Windows install DVD to install a copy of Windows to your hard disk
echo 1 && pause
find --set-root /ImDisk/myiso.cmd
echo 2 && pause
dd if=()/ImDisk/au.xml of=()/AutoUnattend.xml
echo 3 && pause

If the map command fails for 'file not contiguous' - you will need to run WinContig.exe (RMPrepUSB CTRL+F2) on the failing ISO file (on the USB drive) to defrag it. If this fails to work (usually because you do not have enough spare space on the USB drive), then you will need to copy ALL the files from the USB drive to your hard disk, reformat the USB drive using RMPrepUSB as in step 3. It is often faster and easier to re-copy the files than it is to use WinContig on a large USB iso file.

Some grub error numbers are reported here - these may or may not be the same as in grub4dos, but may be useful as a reference.

If you are prompted during Setup with a strange menu such as the one below:

A = Win 7 SP1 32-bit Enterprise
B = Win 7 SP1 32-bit Professional
C = Win 7 SP1 64-bit Enterprise

Then this is because your menu.lst entries were not correct. Have a look at the file MYISO.CMD using Notepad - it should contain the ISO file path and name of the last entry that you chose. If not then you have made a mistake in the menu.lst text - check your menu.lst carefully for missing or extra spaces or characters. If it seems OK, re-copy cr.txt and myiso.cmd to your USB drive again and overwrite the old ones.

P.S. The A/B/C menu comes from code in the file LOADISO.cmd. LOADISO.cmd runs MYISO.cmd - if MYISO.cmd does not have a SET MYISO=xxx command inside it, the LOADISO.cmd will display a pre-set menu instead. The ISO files in this menu won't actually exist (as I made them up!), but you can always edit the LOADISO.cmd file to point at your own ISOs if you really cannot get this to work!

If Setup seems to want to install the wrong version of Windows (e.g. you are prompted to install Vista Business instead of say Windows 7 Home Premium) check that none of your drives have a file in the folder \SOURCES called INSTALL.WIM - this includes any Windows install DVD-ROM you may have left in your DVD-ROM drive!

Some members of reboot.pro have reported that their system does not detect the AutoUnattend.xml on their USB pen. In one case this turned out to be an unlucky combination of Buffalo USB pen, Server 2008 ISO (not R2) and a Dell Latitude E6400. Other USB pens worked and other OS ISO's worked. Another user reported difficulty with their SanDisk pen. If the blue command console window does not briefly pop-up and run during the boot from the ISO or the first part of the Windows Setup GUI, then press SHIFT+F10 to get a console window and type DISKPART followed by LIST DISK to see if your USB drive is listed (if no USB drive is listed then it means your USB drive is incompatible with the OS ISO your are trying to use) - if the USB drive is not listed, type RESCAN and then LIST DISK to see if it is now listed. If it is you may have an incompatible USB drive - try a different make or model. Use EXIT to quit Diskpart.

Alternatively, try the *Note workaround for Fixed disks at the top of this page (i.e. also insert another different USB pen drive with the AutoUnattend.xml file on it).

If you are using an OEM Recovery Disk ISO file, the AutoUnattend.xml detection may be suppressed. In this case you will have to use the manual method detailed in the *Note workaround for Fixed disks at the top of this page and get to a command prompt (SHIFT+F10 may not work so use the OEM Command prompt menu entry instead) - or- unpack the ISO and make a new one without any unattend.xml file in it (the new ISO does not need to be bootable so any 'makeiso' tool will do to make the ISO).

How it works

The boot/mapping sequence goes like this:

ISO mapped as virtual drive by grub4dos -> load WinPE (ISO drive is now lost as in protected mode) -> find and load AutoUnattend.xml -> find and run \ImDisk\LoadIso.cmd -> call MYISO.CMD -> run ImDisk and load ISO as virtual drive under WinPE -> Exit command shell -> Setup continues and finds \sources\Install.wim on virtual disk loaded by ImDisk.

  1. The menu.lst basically just maps the ISO file as a DVD-ROM drive (0xff) but this mapping is lost as soon as Setup fully loads up into RAM and enters protected mode. However, we also write a file (\ImDisk\MYISO.CMD) which contains the text SET MYISO=xxxxx (where xxxx is the path and filename of the ISO that you want to install) to the USB drive. We do this because we need to tell ImDIsk the name and path of the ISO file when Setup starts to run.
  2. When the ISO boots, it will prompt you to 'Press any key to boot from the CD or DVD' - because it thinks you are booting from a DVD (tip: press a key!).
  3. Now when a Windows Vista/7/2K8 WinPE based Setup runs, WinPE always tries to look for a file called AutoUnattend.xml or Unattend.xml which has a 'WindowsPE' section containing commands and configuration settings. The file AutoUnattend.xml must be on a Removable disk and not a Fixed disk. Luckily, we just happen to have such a file (\AutoUnattend.xml) on the USB Flash drive (cos we put it there!). This contains a command to run the file \ImDisk\LOADISO.cmd from wherever it can find it (it searches all drives until it finds it).
  4. LOADISO.cmd has the job of mapping the ISO file as a virtual drive before Setup can continue.
  5. When the file \ImDisk\LOADISO.cmd is run (as AutoUnattend.xml tells Setup to run it) it calls \ImDisk\MYISO.cmd which runs the SET command to set the variable MYISO to the path of the ISO which needs to be loaded. Now that we know the full path we can search for the ISO on all drives until we find out which drive letter the ISO file is on.
  6. LOADISO.cmd then runs ImDisk and maps the ISO file as a virtual drive, ready for Windows Setup to scan and recognise.
  7. We then exit from the LOADISO script to allow WinPE to continue and run Setup.
  8. Setup continues to run once LOADISO has finished executing and starts to look for a drive which has the \sources\install.wim file on it (this contains the Windows images).
  9. Now when Setup looks for the \sources\install.wim file, it finds it on the new virtual drive which was made by ImDisk and thus continues as normal - just as if it booted from a real DVD.

The way that we pass the correct path for the ISO file is via these lines in menu.lst

dd if=()/ImDisk/cr.txt of=()/ImDisk/myiso.cmd
write ()/ImDIsk/myiso.cmd SET MYISO=\\iso\\en_windows_7_enterprise_with_sp1_x64_dvd_620201.iso\r\n

The first line erases the previous contents of myiso.cmd so that it contains all new lines (CR+LF characters) by copying the contents of the cr.txt file to the myiso.cmd file.