New
#1
Request for user testing a batch file that handles large install.wim
I created a tutorial for creating a usb installation drive with a custom install.wim greater than 4GB.
Create bootable USB installer if install.wim is greater than 4GB | Windows 10 Tutorials
I have been upgrading the batch file so it creates the diskpart.dat and ei.cfg files automatically
I would like some user feedback.
It is quite easy to customise now.
Main things to set are
1) drive and path to where the installation files are - they can be a mounted iso or any directory
2) disk number of usb drive when inserted - use diskpart list disk to identify or look in disk management
The script here initially sets it as 99 to avoid deleting a drive if you do not change the number
3) drive and path to where install.wim is if different location (set WIMDIFFLOC to 1)
For the purposes of testing, it does not really matter if install.wim is less than 4GB.
Simply copy all the code into a batch text file e.g. usbcreate.bat, customise as above and run with admin rights.
You need an 8GB drive as a minimum, and all files on drive will be wiped. Original source files are only copied and never affected.
Code:echo on REM ------------------------------------------------------------------------------ REM SET DRIVE LETTER AND PATH OF SOURCE ISO OR DIRECTORY FILES REM MAKE SURE NO TRAILING BLANKS AND PATH FINISHES WITH A \ SET SOURCEFILES=D:\ REM IF CUSTOM INSTALL.WIM IS NOT IN SOURCES DIRECTORY, SET WIMDIFFLOC TO 1 SET WIMDIFFLOC=0 REM SET DRIVE LETTER OF CUSTOM INSTALL.WIM REM MAKE SURE NO TRAILING BLANKS AND PATH FINISHES WITH A \ SET WIMFILE=D:\SOURCES\ REM SET USB FAT32 AND NTFS DRIVE LETTERS (USE HIGHER LETTERS YOU DO NOT USE NORMALLY) SET FAT32DRV=U SET NTFSDRV=V REM SET DRIVE NUMBER OF USB DRIVE - WARNING BE VERY CAREFUL YOU GET THIS RIGHT REM DEFAULT IS SET TO INITIALLY TO 99 TO PREVENT ACCIDENTAL WIPING OF A DRIVE REM YOU CAN CHANGE DEFAULT IF YOU ALWAYS KNOW WHAT DRIVE NUMBER IS ASSIGNED REM TYPICALLY IT WILL BE THAT LAST NUMBER IN DRIVE AND EQUAL TO NUMBER OF INTERNAL HARD DRIVES SET USBDRV=99 REM -------------------------------------------------------------------------------- C: CD\ rd "usbcreate" /s /q md \usbcreate cd \usbcreate md "baseiso" xcopy %SOURCEFILES%*.* "c:\usbcreate\baseiso\" /s /y /q IF %WIMDIFFLOC%==0 GOTO :CONT1 xcopy %WIMFILE% "c:\usbcreate\baseiso\" /s /y /q :CONT1 REM --------------------------------------------------------------------------------------------- REM CREATE DISKPART.DAT echo select disk %USBDRV% > c:\usbcreate\diskpart.dat echo clean >> c:\usbcreate\diskpart.dat echo convert mbr >> c:\usbcreate\diskpart.dat echo create partition primary size=1000 >> c:\usbcreate\diskpart.dat echo create partition primary >> c:\usbcreate\diskpart.dat echo select partition 1 >> c:\usbcreate\diskpart.dat echo format fs=fat32 quick >> c:\usbcreate\diskpart.dat echo assign letter=%FAT32DRV% >> c:\usbcreate\diskpart.dat echo active >> c:\usbcreate\diskpart.dat echo select partition 2 >> c:\usbcreate\diskpart.dat echo format fs=ntfs quick >> c:\usbcreate\diskpart.dat echo assign letter=%NTFSDRV% >> c:\usbcreate\diskpart.dat echo exit >> c:\usbcreate\diskpart.dat diskpart /s "c:\usbcreate\diskpart.dat" echo Exit Code is %errorlevel% if %errorlevel%==0 goto :CONT2 REM DO DISKPART AGAIN IF IT FAILS FIRST TIME - NO IDEA WHY THAT HAPPENS SOMETIMES BUT USUALLY WORKS 2ND TIME diskpart /s "c:\usbcreate\diskpart.dat" echo Exit Code is %errorlevel% if %errorlevel%==0 goto :CONT2 echo Diskpart has failed twice - procedure is aborted echo You can manually partition flash drive and remove this whole section. goto :CONT3 :CONT2 label %fat32drv%:USB-FAT32 label %ntfsdrv%:USB-NTFS REM -------------------------------------------------------------------------------------------- xcopy "c:\usbcreate\baseiso\*.*" %NTFSDRV%:\ /s /y /q rd "c:\usbcreate\baseiso\sources\" /s /q md "c:\usbcreate\baseiso\sources\" xcopy "c:\usbcreate\baseiso\*.*" %FAT32DRV%:\ /s /y /e /q xcopy "%NTFSDRV%:\sources\boot.wim" "%FAT32DRV%:\sources\" /y /q REM -------------------------------------------------------------------------------------------- REM CREATE EI.CFG IN SOURCES FOLDER echo [CHANNEL] > "%NTFSDRV%:\sources\ei.cfg" echo Retail >> "%NTFSDRV%:\sources\ei.cfg" REM --------------------------------------------------------------------------------------------- :CONT3 pause
Last edited by cereberus; 09 Nov 2018 at 15:22.