Home » How To » How to Create a Recovery Partition in Windows 10 (Custom Factory Reset)

How to Create a Recovery Partition in Windows 10 (Custom Factory Reset)

If you bought a pre-built system or a laptop, you might have seen a factory reset option which resets Windows 10 to its factory built state. Using the recovery partition, you can easily restore Windows when it is corrupted or cannot boot. Let me show you how to create a Windows 10 recovery partition of your own in simple steps.

A Few Things Before You Can Create Your Own Custom Recovery Partition in Windows 10

Before you can create a recovery partition in Windows 10, there are a few things you need to know and should have.

1. Keep your Windows 10 installation media ready. We are going to use the windows 10 installation drive to extract the OS image which can then be used to create a recovery image. If you don’t have the installation media, you can easily create a Windows 10 USB drive yourself. Make sure that the installed Windows 10 version and downloaded Windows 10 ISO version is the same. For instance, if I’m using Windows 10 v1809, the installation media should also be of v1809.

2. You should know how to create a partition. To create a partition, you can use the built-in disk management tool or third-party software like EaseUS Partition Manager.

3. Make sure that you’ve installed all the Windows updates and software that you use regularly. This makes it sure that when you restore your system using the recovery partition, you will have all your software ready to use.

4. This is not necessary but makes your life easier when using the command prompt. In the File Explorer, rename the C Drive to something you can easily recognize. For instance, I renamed my drive to OS Drive. To rename a drive, simply right-click on the drive and select “Rename”.

Windows 10 create recovery partition 01

Create Recovery Partition in Windows 10

Creating a custom factory reset partition in Windows 10 is fairly simple. However, it is lengthy. So, to make matters simple, I’ve divided the steps into three sections. Just follow the below steps as is and you should be good.

1.1 Extract Windows Image to Create Windows 10 Recovery Partition

The first thing we need to do is extract the Windows 10 image. However, since you cannot extract the Windows 10 image while you are using it, we need to boot into the Windows 10 installation media.

1. Plug in the Windows 10 installation drive, reboot your system and boot into the installation media.

Windows 10 create recovery partition 02

2. In the language selection screen, press Shift + F10 to open the command prompt window.

Windows 10 create recovery partition 03

3. When you boot into Windows 10 installation media, there is a chance the drive letters will be changed temporarily. So, it is better to know the current drive letter of the OS installation drive and the drive where you’d like to store the extracted image file. To know the drive letter, we need to use the diskpart utility. So, execute the below command.

diskpart

Windows 10 create recovery partition 04

4. Next, use the below command to list all the volumes in your system. In my case, the drive letter didn’t change. So, my OS installation drive letter is still C and the drive where I want to save the extracted image is D. Remember both drive letters, you need them in the next step.

listvol

Windows 10 create recovery partition 05

5. Once you know the drive letters, exit the diskpart tool using the below command.

exit

6. Now, use the below command to extract the OS image and save it to the drive of your choice. Don’t forget to replace <DestinationDriveLetter> with the actual destination drive letter and <OSInstallationDriveLetter> with the actual OS installation drive letter.

dism /capture-image /imagefile:<DestinationDriveLetter>:\install.esd /capturedir:<OSInstallationDriveLetter>:\ /name:"Recovery" /compress:maximum

Once you add the drive letters, the command will look something like this. I’m extracting the Windows 10 image from C drive and storing it in the D drive.

dism /capture-image /imagefile:D:\install.esd /capturedir:C:\ /name:"Recovery" /compress:maximum

Windows 10 create recovery partition 06

7. As soon as you execute the above command, Windows starts to extract the image. It can take some time to complete.

Windows 10 create recovery partition 07

8. Once that is done, the extracted image will be saved to the drive you chose earlier. Close the command prompt window and reboot Windows 10.

Windows 10 create recovery partition 08

9. After rebooting Windows, if you go the drive where you save the extracted image, you will see a file named “install.wim”. In my case, the install.wim file is around 5GB. This can vary depending on the applications and updates you’ve installed.

1.2 Copy Windows 10 Installation Files to Recovery Partition

10. Now, create a new partition that is a couple of gigabytes bigger than the size of the install.wim file. For instance, if your extracted install.wim file is around 10GB, create a new partition that is around 12GB. Remember the drive letter of the new partition, we are going to need it in the coming steps.

Windows 10 create recovery partition 09

11. Now, plug in the Windows 10 USB drive, copy all the files in it and paste them in the new partition.

Windows 10 create recovery partition 10

12. Next, copy the extracted “install.wim” file and paste it inside the “sources” folder in the new partition. You will see a duplicate file warning. Select “Replace” to replace the already existing “install.wim” file with the newly extracted “install.wim” file.

Windows 10 create recovery partition 11

1.3 Add Recovery Partition to Advanced Boot Menu

Up until now, we’ve only created the recovery partition. We now need to add that recovery partition to the advanced boot menu. We are going to do that using a batch file. This allows you to boot into recovery from the advanced startup options.

13. Right-click on the desktop and select “New -> Text document”.

Windows 10 create recovery partition 12

14. Rename the text file to “recovery.bat”. You can name the file anything you want, just make sure that the file extension ends with .bat.

Windows 10 create recovery partition 13

15. Right click on the batch file and select “Edit”.

Windows 10 create recovery partition 14

16. Paste the following code in the notepad and click on the “File -> Save” option. Close the file after saving.

Important note: If you are on a Legacy BIOS system, change “winload.efi” in line 21 to “winload.exe”. If you don’t know, you can easily check if you are on a UEFI or Legacy BIOS system.

@ECHO OFF
TITLE Add Recovery to Windows boot menu
:SETLETTER
CLS
ECHO.
ECHO ###################################################
ECHO # This batch file creates recovery environment    #
ECHO # adding it to Windows boot menu.                 #
ECHO ###################################################
ECHO.
SET /P DRIVELETTER= ^-- Please enter drive letter for your custom recovery partition (without colon): 
IF NOT EXIST %DRIVELETTER%:\sources\boot.wim ECHO. & ECHO No valid Windows image found on given partition %DRIVELETTER% &ECHO. & PAUSE & GOTO :SETLETTER
ECHO.
bcdedit /create {ramdiskoptions} /d "Ramdisk"
bcdedit /set {ramdiskoptions} ramdisksdidevice partition=%DRIVELETTER%:
bcdedit /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi
for /f "tokens=2 delims={}" %%i in ('bcdedit.exe /create /d "Recovery" /application OSLOADER') do (set guid={%%i})
bcdedit /set %guid% device ramdisk=[%DRIVELETTER%:]\sources\boot.wim,{ramdiskoptions}
bcdedit /set %guid% path \windows\system32\winload.efi
bcdedit /set %guid% osdevice ramdisk=[%DRIVELETTER%:]\sources\boot.wim,{ramdiskoptions}
bcdedit /set %guid% systemroot \windows
bcdedit /set %guid% winpe yes
bcdedit /set %guid% detecthal yes
bcdedit /displayorder %guid% /addlast
pause

Windows 10 create recovery partition 15

18. Open the start menu, search for the command prompt, right-click on it and select the “Run as administrator” option.

Open command prompt as admin

19. Since the batch file is on the desktop, use the below command to go to the desktop. Replace <username> with your actual Windows 10 username.

cd c:\users\<username>\desktop

Windows 10 create recovery partition 16

20. Once you are in the desktop, execute the batch file with its name.

Windows 10 create recovery partition 17

21. As soon as you execute the file, the command prompt will ask you to enter the recovery partition drive letter. Type the drive letter and press Enter. In my case, the recovery partition drive letter is F.

Windows 10 create recovery partition 18

22. The script will now add the recovery partition to the advanced startup boot options menu. Once the script has been executed successfully, you can close the command prompt window.

Windows 10 create recovery partition 19

That is it. You’ve successfully created your own recovery partition in Windows 10 and added it to the boot options.

Windows 10 Create Recovery Partition Conclusion

As you can see, it is pretty easy to create a recovery partition in Windows 10. To see the recovery partition you need to boot into advanced startup options. To do that, open the Settings app, go to “Update and Security -> Recovery” and click on the “Restart Now” button under Advanced Startup. In the Advanced Startup options, click on the “Use another operating system” option.

Windows 10 create recovery partition 21

You will see the recovery option.

Windows 10 create recovery partition 20

If you ever cannot boot into Windows, simply boot into the Windows 10 installation media, press Shift + F10 to open the command prompt, and execute the below command. Replace <DriveLetter> with the actual drive letter of the recovery partition. This action will reinstall Windows with all your applications and updates intact.

<DriveLetter>:\setup.exe

Once you replace the actual drive letter, this is how the command should look like.

F:\setup.exe

Hope that helps. If you like this article, do check out how to lock folder in Windows 10 and how to change timezone in Windows 10.

18 thoughts on “How to Create a Recovery Partition in Windows 10 (Custom Factory Reset)”

  1. Avatar for Abdullah

    Great article! Thank you for sharing it. It was easy to follow.

    I have a question:

    Should I change the partition ID type to
    SET ID=de94bba4-06d1-4d40-a16a-bfd50179d6ac

    so that the OS knows it is a recovery partition?

    And should I change GPT attributes to
    GPT ATTRIBUTES=0X0000000000000001

    so that the drive letter doesn’t show in Windows?

    Thank you.

  2. Avatar for Abdullah

    Ok, so I now realised that after following this, it’s asking me to ‘choose an operating system’ every time I boot. It shows the normal Windows installation, and also the recovery installation.

    How can I stop this?

    In my opinion it should only show the recovery partition if I select “advanced startup options”. Not on every boot.

    1. Avatar for Bashkarla

      You can choose the default operating system from the advanced system settings. Search for “view advaned system settings” in the start menu and click on the “settings” button under Startup and Recovery section. In the new window, see if you can select the default OS.

      1. Avatar for Abdullah

        Windows 10 is already set as the default OS in the settings you suggested.
        That just means that if I don’t press anything during startup, it will default to that choice after 30 seconds.
        But it will still show me the choice. I don’t think it should.
        Was it th same when you followed the tutorial?

    2. Avatar for Johnson Saji

      On Windows 10, if you create any other operating system, it will always show you which operating system you need to boot into. You can choose a default operating system, but Windows does this for easier use of the operating system. You just select Windows 10 when starting the system, and it will load Windows 10.

  3. Avatar for Chad

    FAIL!

    Error: 0x80310000

    DISM failed. No operation performed.
    For more information, review the log file.

    The DISM log file can be found at X:\windows\Logs\DISM\dism.log

    Thanks!

    1. Avatar for Ray

      Ah, so that is why I did not get the warning of “replace file” on step 12. So that seems to end this as to not work. (I’m not a pro at this.) Seeing this, my wim is 24gig whereas my esd is 3gig. I was about to test this but had I, I would be back to a fresh install.
      I did do a backup of win 10 on a separate hard drive. (A fresh install, but with everything I added and modified to my preferences- like Firefox and taskbar changes.) Would I do better just to copy that into my restore partition and delete all the above efforts?

  4. Avatar for Ray

    The error of the question I asked is that I would be trying to image the very partition holding the image unless I did not put that partition into the image file. But then it would (probably) try to delete that partition in the end.

    Well, I did find out how to convert the .wim to a .esd, and I did that and copied it into the recovery partition, which did give me the warning of “over-write”. I wanted to test it and it asked for my windows key on the choice of “Install”. I would have figured it should have that key for a recovery. So I backed up and tried the repair option. It ran me in circles rebooting back through the screens.

    I just thought to come back and add this, so someone would not be compelled to point out my error of the question.

  5. Avatar for David

    Thanks very much for this its a big help, I was looking for something like this to create an image of just OS and drivers for my laptop. Not sure if anyone realised but this does mean you can create custom boot media from the USB pen to? Just create a basic one using Microsoft creation media then as long as u have enough storage replace the default ESD with your version.

  6. Avatar for David

    I’ve just found u can’t make creation tool usb pens with a ESD over 4gb 🙁 anyway to create a custom Windows 10 install USB with your own version off ESD on it?

  7. Avatar for David Duxbury

    Get Error 5
    Access is denied.
    I have tried both install.wim and then discovered in the feed it should be install.esd (as written in the example line not as snapshot),but still the same error.

  8. Avatar for T3dr1c

    Thanks for posting this information on how to setup a recovery partition and not a thumb drive. It’s the best one I’ve found so far.

    I am running DISM version 10.0.18362.1 on Win 10 Pro v1909

    However, I was getting “path could not be found” errors when running the posted command
    “dism /capture-image /imagefile:D:\install.esd /capturedir:C:\ /name:”Recovery” /compress:maximum”

    After looking at the command, and trying different variations, I found that switching the command around to “dism /capture-image /capturedir:C:\ /imagefile:D:\install.wim /name:”Recovery” /compress:maximum”
    it worked like a charm.

    My next step was to convert the ‘install.wim’ file to ‘install.esd’, using the DISM tool. Which one of the other commenters here was correct, the latest version does use the .ESD extension for the image file.

    As an afterthought. I probably should have just made an ‘install.esd’ instead of the .wim file, to save myself some time.

    Hope this helps anyone who comes across this.

    Cheers!

  9. Avatar for Jim Q

    I don’t understand why when I run:
    “c:\Users\vrtua\Desktop>create_recovery.bat”
    It errors with message:
    “‘create_recovery.bat’ is not recognized as an internal or external command,
    operable program or batch file.”
    Anyone have any ideas?

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top