This tutorial will show you how to manually create a bootable WinPE 5.0 x64 USB drive. WinPE 5.0 is based on Windows 8.1.
It is very similar to my previous tutorial, but there are a few small changes to the packages.
I assume you are computer savvy and have at least basic knowledge regarding running commands and batch scripts.
By the way, there's also a much faster way to create a WinPE 5.0 USB drive, for those who have Windows 8.1 installed, using the command RecoveryDrive.exe.
We're not going to use this command in this tutorial, rather get our hands a little dirty and do it all manually.
*All screenshots in this tutorial are from Windows 7 SP1 x64 eng.
1. First you need a PC with Windows 7 (or higher) installed on it. You obviously need a flash drive, 4GB should be enough.
2. You'll also need to download the ADK for Windows 8.1, or the ADK for Win10 b10586, or the ADK for Win10 b14295...and install it (the actual download is pretty large, between 2.85GB to 3.18GB).
When installing the ADK, you'll only need to select the options I marked in this screenshot:
3. Now we're going to make your flash drive bootable. Make sure it doesn't contain important files.
From the Start Menu -> All Programs -> Windows Kits -> Windows ADK, open the Deployment and Imaging Tools Environment, and type:
[ATTENTION: Replace ‘#’ with the DISK number of your flash drive as it appears after typing LIST DISK]
[ATTENTION: Replace DRIVE_LETTER with the letter assigned to your USB flash drive after typing 'assign'. You can see it in Windows Explorer]
diskpart list disk select disk # clean create par primary select par 1 active format quick fs=fat32 label=WinPE5 assign exit bootsect /nt60 DRIVE_LETTER /mbr
Here's an example screenshot:
4. Go to: [ADK Install DIR]\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\Media
5. Copy the entire "Media" folder to C:\Temp\PE5 (so now you should have C:\Temp\PE5\Media).
6. Copy [ADK Install DIR]\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\en-us\winpe.wim into: C:\Temp\PE5\Media\Sources (create this new "Sources" folder).
7. Rename the file you copied, from “winpe.wim” to “boot.wim“.
8. From the Start Menu -> All Programs -> Windows Kits -> Windows ADK, open the Deployment and Imaging Tools Environment, and type:
cd /d C:\Temp\PE5
9. We now need to create a new folder which will act as a mount point for the WIM file, so type:
10. To mount the WIM file, type:
DISM /Mount-Wim /WimFile:C:\Temp\PE5\Media\Sources\boot.wim /Index:1 /MountDir:C:\MOUNT
11. We’re now going to modify the boot.wim file by inserting some optional components, which can be found here:
[ADK INSTALL DIR]\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs
Copy the "WinPE_OCs" folder to C:\Temp\PE5 (so now you should have C:\Temp\PE5\WinPE_OCs).
NOTE: To see what each component contains/adds to WinPE, check this MS article.
12. ATTENTION: After adding each component, we must also add its corresponding language file, otherwise the component you add won’t work!!
I recommend adding the following components, in the order they appear:
13. Now let's see how to add some drivers to your WinPE5.0. This step is optional, so if you're doing this for the first time, you can skip it.
First, you'll need to extract the driver so that its CAT, SYS and INF files are accessible, i.e. not in ZIP file.
To add a (single) driver, type for example:
dism /image:C:\MOUNT /add-driver /driver:"C:\PathToDriver\drivername.inf"
Preferably, if you have a folder containing several drivers (each in its own folder), you can add them all in one go by typing:
dism /image:C:\MOUNT /add-driver /driver:[PATH TO DRIVERS FOLDER] /Recurse /ForceUnsigned
This will take a while depending on the quantity and size of the drivers.
14. At this point, prior to committing your changes and unmounting the WIM file, you can copy certain portable standalone applications (such as Process Explorer, Ghost64, etc) into C:\MOUNT so that they will reside inside the WIM file.
However, I discourage you from doing so, as there's a better way, so bare with me.
15. Go into C:\MOUNT\Windows\System32 and open the file StartNet.cmd with Notepad (right-click on it and select "Edit").
16. By default, it only contains a single line (wpeinit). Replace its contents with the following, then save the file:
wpeinit @echo off for %%p in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%p:Qdir set w=%%p call %w%:Qdir\Q-dir.exe
The code below is based on Microsoft's own documentation; it does pretty much the same as above.
I've tried it, and it works just as well, so use one or the other:
wpeinit @echo off @color 1F :: sets bg color to blue, and text to white wpeutil.exe WaitForRemovableStorage wpeutil.exe UpdateBootInfo set PEBootRamdiskSourceDrive= for /f "tokens=1-3 delims== " %%a in ('reg.exe query "HKLM\SYSTEM\CurrentControlSet\Control" /v "PEBootRamdiskSourceDrive" 2^>nul') do ( if %%a.==PEBootRamdiskSourceDrive. @set PEBootRamdiskSourceDrive=%%~dc ) if Defined PEBootRamdiskSourceDrive ( echo PEBootRamdiskSourceDrive is %PEBootRamdiskSourceDrive% ) @call %PEBootRamdiskSourceDrive%\QDir\Q-Dir.exe
17. ATTENTION: We’re now going to commit our changes and unmount the WIM file. Close ALL file explorers, or the unmount process will give you an error!!
Then type the following command:
DISM /Unmount-Wim /MountDir:C:\MOUNT /Commit
When this process is finished, the C:\MOUNT folder will be empty.
18. It is advised to optimize the WIM file, so run the command:
DISM.exe /export-image /sourceimagefile:C:\Temp\PE5\Media\Sources\boot.wim /sourceindex:1 /destinationimagefile:C:\Temp\PE5\Media\Sources\boot_optimized.wim
The optimized file should be a little smaller. It is safe to delete the boot.wim file, and then rename the boot_optimized.wim to boot.wim.
19. Now copy the contents of the folder C:\Temp\PE5\Media to your flash drive (To clarify: Copy what's inside the folder, not including the folder itself).
The WinPE5.0 flash drive is now bootable.
20. Grab Q-Dir portable x64 from here, and extract the files to your bootable flash drive. Make sure the folder is named "QDir" (without the dash) and resides on the root of the drive.
21. Eject the flash drive, and boot from it by selecting it from the BIOS Boot Menu.
The exact key to get to the Boot menu depends on which motherboard you have.
On Dell computers it's usually F12. On Gigabyte motherboards it's also F12.
Other manufacturers use a different key to get to the boot menu. Please check yours.
Once you are in the boot menu, you'll probably see something like this (I'm using a Gigabyte motherboard, and SanDisk flash drive):
You can choose to boot in legacy mode, or in UEFI mode. Both should work just fine.
22. Once it's done loading, QDir should appear and you can pretty much do anything from here on.
Q: I've followed the guide to the letter, but my USB drive is not booting (I selected it as first boot device). What to do?
A: 1. Download BootIce from here (zip file size is only 857KB): BootIce by Pauly v126.96.36.199
2. Extract and run BOOTICEx64.exe (or BOOTICEx86.exe if you're using a 32bit OS)
3. Follow the steps in the following screenshot:
4. Try to boot again.