Phurious Posted January 12, 2007 Author Share Posted January 12, 2007 Here is my BAT file for a bootable PE 2.0 USB creation:@ECHO OFFREM Set our variables so our fingers do not wear down to nubsREM typing paths. Also helps reduce typos (Ask me how I know).SET sIMAGEX=C:\Program Files\Windows AIK\Tools\x86SET sSOURCE=C:\winpe_x86SET sPETOOLS=C:\Program Files\Windows AIK\Tools\PEToolsSET sUSB=F:REM Creates the DISKPART.EXE script so you do not have to. ThisREM Script ASSUMES that your USB drive is the only other HDD onREM the computer. If you have more than one drive on your PCREM you are going to have to adjust the first line to reflect theREM correct disk number.ECHO SELECT DISK 1 > PEDiskPart.txtECHO CLEAN >> PEDiskPart.txtECHO CREATE PARTITION PRIMARY >> PEDiskPart.txtECHO ASSIGN LETTER=%sUSB% >> PEDiskPart.txtECHO SELECT PARTITION 1 >> PEDiskPart.txtECHO ACTIVE >> PEDiskPart.txtECHO *** Beginning file copy ***ECHO.ECHO.REM Creates the initial build location%COMSPEC% /c "%sPETOOLS%\copype.cmd" x86 %sSOURCE%REM Mounts the WINPE.WIM so we may customize the image"%sIMAGEX%\imagex.exe" /mountrw %sSOURCE%\winpe.wim 1 %sSOURCE%\mountREM Corrects a Microsoft error that looks for WINLOAD.EXE in the wrong directoryXCOPY "%sSOURCE%\mount\Windows\System32\Boot\*.*" %sSOURCE%\mount\Windows\System32\ /e /yREM Copies the Servicing folder to the image so we have the extra tools when weREM boot into PEXCOPY "C:\Program Files\Windows AIK\Tools\Servicing" c:\winpe_x86\mount\Windows /sREM This copies the IMAGEX.EXE tool and other required files so we may use when in PEXCOPY "C:\Program Files\Windows AIK\Tools\x86" c:\winpe_x86\mount\Windows /s /YECHO.ECHO.ECHO *** File copy complete ***ECHO.ECHO.PAUSECLSREM I am installing additional drivers for PE 2.0 below. As you can see, I am addingREM network drivers that cover most all of the PC and laptop hardware we currentlyREM use. ECHO *** Installing additional drivers ***ECHO.ECHO."%sPETOOLS%\peimg.exe" /inf:C:\lan\3COMA\OEMSETUP.INF %sSOURCE%\Mount\Windows"%sPETOOLS%\peimg.exe" /inf:C:\lan\3COMB\NET556N5.INF %sSOURCE%\Mount\Windows"%sPETOOLS%\peimg.exe" /inf:C:\lan\B44\b44win.inf %sSOURCE%\Mount\Windows"%sPETOOLS%\peimg.exe" /inf:C:\lan\B57\b57win32.inf %sSOURCE%\Mount\Windows"%sPETOOLS%\peimg.exe" /inf:C:\lan\Intel\E1000325.inf %sSOURCE%\Mount\WindowsECHO.ECHO.ECHO *** Driver installs complete ***ECHO.ECHO.PAUSEREM You should specify any additional packages you want installed to the off-line image hereECHO *** Installing specified packages ***ECHO.ECHO."%sPETOOLS%\peimg.exe" /install=WinPE-HTA-Package %sSOURCE%\Mount\WindowsECHO.ECHO."%sPETOOLS%\peimg.exe" /install=WinPE-WMI-Package %sSOURCE%\Mount\WindowsECHO.ECHO."%sPETOOLS%\peimg.exe" /install=WinPE-Scripting-Package %sSOURCE%\Mount\WindowsECHO.ECHO."%sPETOOLS%\peimg.exe" /install=WinPE-XML-Package %sSOURCE%\Mount\WindowsECHO.ECHO."%sPETOOLS%\peimg.exe" /install=WinPE-MDAC-Package %sSOURCE%\Mount\WindowsECHO.ECHO.ECHO *** Package installs complete ***ECHO.ECHO.PAUSECLSREM Closes the WINPE.WIM file and copies it to C:\winpe_x86\ISO\sources\boot.wimECHO *** Closing and dismounting the image ***ECHO.ECHO."%sIMAGEX%\imagex.exe" /unmount %sSOURCE%\mount /commitCOPY %sSOURCE%\winpe.wim %sSOURCE%\ISO\sources\boot.wim /YECHO.ECHO.ECHO *** Image successfully dismounted and copied to BOOT.WIM ***ECHO.ECHO.PAUSECLSREM The following commands clean the HD, create a primary Partition, and sets it to active. Afterwards, the driveREM is formatted, and BOOTSECT.EXE is run to add the Vista master boot code to the drive.ECHO.ECHO.ECHO !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!ECHO.ECHO *** Please be aware the next step will erase all the data from your USB drive! *** ECHO.ECHO !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!ECHO.ECHO.PAUSEECHO.ECHO.DISKPART /s PEDiskPart.txtFORMAT %sUSB% /FS:NTFS /V:PE_2 /Q /Y"%sPETOOLS%\x86\bootsect.exe" /nt60 %sUSB%ECHO.ECHO.DEL PEDiskPart.txtPAUSECLSREM Copies our source files the the newly prepared USB drive.ECHO.ECHO.ECHO *** Copying source files to the USB drive ***ECHO.ECHO.XCOPY %sSOURCE%\iso\*.* /s /e /y /f %sUSB%ECHO.ECHO.ECHO *** Bootable USB drive creation complete ***ECHO.ECHO.PAUSEIf you want to use the format commands at the bottom be aware you need to change the /FS switch from NTFS to FAT32. I made this BAT for a couple of guys at work; that is why I have it generating the diskpart script at the begininng, so they don't have to (Or have it in the wrong place etc.) . Link to comment Share on other sites More sharing options...
nopants Posted January 18, 2007 Share Posted January 18, 2007 If you want to use the format commands at the bottom be aware you need to change the /FS switch from NTFS to FAT32. I made this BAT for a couple of guys at work; that is why I have it generating the diskpart script at the begininng, so they don't have to (Or have it in the wrong place etc.) .(sorry for the delayed response)Have you tried FAT32? I changed my script to format NTFS and now I can build a bootable USB key from WinXP.I would prefer to stick with FAT32 but will take what I can get. I also had to change the "Safe Removal Policy" ("Optimize for Performance") to allow the format to NTFS to occur. Link to comment Share on other sites More sharing options...
MarkC Posted August 16, 2010 Share Posted August 16, 2010 If you want to use the format commands at the bottom be aware you need to change the /FS switch from NTFS to FAT32. I made this BAT for a couple of guys at work; that is why I have it generating the diskpart script at the begininng, so they don't have to (Or have it in the wrong place etc.) .(sorry for the delayed response)Have you tried FAT32? I changed my script to format NTFS and now I can build a bootable USB key from WinXP.I would prefer to stick with FAT32 but will take what I can get. I also had to change the "Safe Removal Policy" ("Optimize for Performance") to allow the format to NTFS to occur.I know this is old, but the problem is that the XP version of Diskpart does not read USB sticks as "drives" unless the RMB (removable media bit) has not been set. Windows PE 2.0 must have the newer version of Diskpart. I am looking for a download of the Diskpart executable, or I can try to use a third-party program. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now