Information
As discussed in tutorial DISM - Split install.wim file | Windows 10 Tutorials, it is not possible to create a bootable flash drive in fat32 format if the install.wim file is over 4GB in size. That tutorial presents a method to split the install.wim into smaller sub-files.
However, since Windows 10 1703, it is now possible to create a flash drive with multiple partitions which leads to an alternative solution.
Basically, two partitions are created i.e. a small (say 1GB) fat32 partition and a larger NTFS partition. The files from a standard installation iso are copied to the NTFS partition, and the standard install.wim file is replaced with the custom install.wim.
Similarly, all the files from the standard ISO image are copied to the fat32 partition except the files from the sources folder where only the boot.wim file is copied.
This guide does not supersede method in above tutorial but is an alternative method if using windows 10 1703 onwards
Here is a batch file that automates the copying process.
Here's How
You need at least an 8GB flash drive or larger depending on size of install.wim
1) Create folder on C drive called usbcreate (change drive and folder as you wish)
2) Create text file called ei.cfg with just two lines
[CHANNEL]
Retail
and save in folder c:\usbcreate
3) mount base iso as a drive and note Drive letter (It is assumed to be E: for this example)
4) copy custom install.wim to folder c:\usbcreate
5) create batch file called usbcreate.bat containing following text
Code:c: cd \usbcreate rd "baseiso" /s /q md "baseiso" xcopy E:\*.* "c:\usbcreate\baseiso\" /s /y diskpart /s "c:\usbcreate\diskpart.dat" label Q:USB-FAT32 label R:USB-NTFS xcopy "c:\usbcreate\install.wim" "c:\usbcreate\baseiso\sources\" /y xcopy "c:\usbcreate\ei.cfg" "c:\usbcreate\baseiso\sources\" /y xcopy "c:\usbcreate\baseiso\*.*" R:\ /s /y rd "c:\usbcreate\baseiso\sources\" /s /q md "c:\usbcreate\baseiso\sources\" xcopy "c:\usbcreate\baseiso\*.*" Q:\ /s /y /e xcopy "E:\sources\boot.wim" "Q:\sources\" /y
6) Identify disk number for use in diskpart script
Insert flash drive and open admin command prompt and type
diskpart
7) Create a text file called diskpart.dat containing following text changing # as appropriate (do not copy lines in brackets). Save file in folder usbcreate.list disk
and note drive number of usb flash drive.
Code:(Replace # with drive number of usb flash drive obtained from Step 6) select disk # (Warning: Drive gets wiped, so be sure you have selected correct drive) clean convert mbr create partition primary size=1000 create partition primary select partition 1 format fs=fat32 quick assign letter=Q active select partition 2 format fs=ntfs quick(exFAT works as well - you can use basic steps in Linux or MAC)exit
8) Right click usbcreate.bat and run with admin rights.
I have created a batch file below (copy all text to a batch file and run as administrator) that does all the above steps. User has to configure the drive letter of the mounted iso and drive number for the usb drive. Be very careful configuring drive number as you can wipe wrong drives.
THE USB DRIVE NUMBER IS INITIALLY SET AT 99, SO YOU HAVE TO MANUALLY EDIT BATCH FILE FIRST TIME TO RUN IT. IF YOU DO NOT CHANGE THE NUMBER FROM 99, BATCH FILE WILL GIVE WARNING AND EXIT.
THE ISO DRIVE LETTER IS SET AS E. EITHER EDIT BATCH FILE FOR YOUR LETTER OR CHANGE DRIVE LETTER TO E IN DISK MANAGEMENT.
ALL OTHER SETTINGS CAN BE LEFT ALONE UNLESS YOU WISH TO CHANGE THEM.
WARNING - DO NOT USE THIS BATCH FILE IF YOU ARE UNSURE HOW TO SELECT CORRECT DRIVE
WARNING - MAKE SURE YOU HAVE BACKED UP ALL DATA ON INTERNAL DISKS
WARNING - THIS WILL WIPE USB DRIVE COMPLETELY SO MAKES SURE ANY DATA ON USB DRIVE IS ALSO BACKED UP
Code:echo off REM ========================================================================================= REM ======BIG WARNING - FIRST TWO PARAMETERS MUST BE CONFIGURED CORRECTLY =================== REM ========================================================================================= REM SET DRIVE NUMBER OF MOUNTED USB DRIVE - WARNING THIS MUST BE CORRECT. REM IT IS USUALLY LAST ONE IN DRIVE NUMBER LIST REM VERY BIG WARNING - IF YOU CHOOSE WRONG DRIVE YOU WILL WIPE IT!!! set USBDRIVE=99 REM SET DRIVE LETTER OF MOUNTED DRIVE - IF DRIVE LETTER IS WRONG, BATCH WILL NOT WORK. set ISODRIVE=E REM ========================================================================================= REM ================== ALL OTHER PARAMETERS CAN NOMRALLY BE LEFT ALONE ====================== REM ============== ONLY CHANGE DRIVE LETTERS IF NEEDED E.G. USED ELSEWHERE ================== REM ========================================================================================= REM SET DRIVE OF TEMPORARY FILES set USBTDRV=C REM SET DRIVE LETTER OF FAT32 PARTITION set FAT32=Q REM SET DRIVE LETTER OF EXFAT PARTITION set EXFAT=R REM CREATE WORKING DIRECTORY %USBTDRV%: cd\ rd usbcreate /s /q md usbcreate REM LIST DISKS AND CHECK USB DRIVE NUMBER IS SET echo LIST DISK > %USBTDRV%:\usbcreate\listdisk.txt CLS diskpart /s %USBTDRV%:\usbcreate\listdisk.txt IF %USBDRIVE%==99 goto :NOTSET GOTO :CONT1 :NOTSET echo off echo. echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX echo X X echo X YOU HAVE NOT SET DRIVE NUMBER OF USB DRIVE X echo X IT IS USUALLY LAST ONE IN THE ABOVE LIST BUT CAN DIFFER X echo X X echo X MAKE SURE USB DRIVE IS PLUGGED IN X echo X X echo X WARNING - MAKE SURE DRIVE NUMBER IS RIGHT X echo X OR ELSE YOU COULD WIPE WRONG DRIVE X echo X X echo X I ACCEPT NO RESPONSIBILITY FOR ANY MISTAKES X echo X YOU HAVE BEEN WARNED!!!!! X echo X X echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX PAUSE GOTO :ENDPROG :CONT1 REM CREATE EI.CFG echo [CHANNEL] > %USBTDRV%:\usbcreate\ei.cfg echo Retail >> %USBTDRV%:\usbcreate\ei.cfg REM FORMAT USB DRIVE echo select disk %USBDRIVE% > %USBTDRV%:\usbcreate\formatdisk.txt echo clean >> %USBTDRV%:\usbcreate\formatdisk.txt echo convert mbr >> %USBTDRV%:\usbcreate\formatdisk.txt echo create partition primary size=2000 >> %USBTDRV%:\usbcreate\formatdisk.txt echo create partition primary >> %USBTDRV%:\usbcreate\formatdisk.txt echo select partition 1 >> %USBTDRV%:\usbcreate\formatdisk.txt echo format fs=fat32 quick >> %USBTDRV%:\usbcreate\formatdisk.txt echo assign letter=Q >> %USBTDRV%:\usbcreate\formatdisk.txt echo active >> %USBTDRV%:\usbcreate\formatdisk.txt echo select partition 2 >> %USBTDRV%:\usbcreate\formatdisk.txt echo format fs=exFat quick >> %USBTDRV%:\usbcreate\formatdisk.txt echo assign letter=R >> %USBTDRV%:\usbcreate\formatdisk.txt echo exit >> %USBTDRV%:\usbcreate\formatdisk.txt diskpart /s %USBTDRV%:\usbcreate\formatdisk.txt REM CREATE DRIVE cd \usbcreate md baseiso xcopy %ISODRIVE%:\*.* %USBTDRV%:\usbcreate\baseiso\ /s /y REM COPY ALL FILES TO EXFAT FOLDER label %EXFAT%:USB-EXFAT %USBTDRV%: cd \usbcreate\baseiso xcopy *.* %EXFAT%:\ /s /y xcopy %USBTDRV%:\usbcreate\ei.cfg %EXFAT%:\sources /s /y REM COPY ALL FILES EXCEPT THOSE IN SOURCES FOLDER (DELETE FROM BASEISO) label %FAT32%:USB-FAT32 del %USBTDRV%:\usbcreate\baseiso\sources\*.* /q cd %USBTDRV%:\usbcreate\baseiso rd sources /s /q %USBTDRV%: cd \usbcreate\baseiso xcopy *.* %FAT32%:\ /s /y cd %FAT32%:\ md sources xcopy %EXFAT%:\sources\boot.wim %FAT32%:\sources\boot.* /s /y REM DELETE WORKING DIRECTORY %USBTDRV%: cd\ rd usbcreate /s /q :ENDPROG
Related Tutorials
- How to Create Bootable USB Flash Drive to Install Windows 10 from
- How to Create Windows 10 USB Install Media for UEFI / GPT with PowerShell Script
- How to split a custom install.wim file
- How to keep Windows 10 USB install media up to date using a PowerShell script