If you forget to unmount a .WIM file it will lock itself on your HDD and you will be unable to delete it, or the C:\winpe_x86 directory. This process will remove those files using the command line.
Trouble deleting the c:winpe_x86 directory
This process tries to free up locked files so that you can manually delete them. Once completed, try and remove the entire mount folder containing all the locked files.
If it still isn’t fixed by running the above, you will need to display a list of the mounted WIMS.
There are two possible scenarios here. The first happens when you try and manually delete files before running this command line code. The status of the file is listed as “Needs Remount”. If you see this you will have to remount the .WIM.
The other possible option is that the image is mounted fine and you could move on. You’re in good shape is the status reads “OK”.
If it’s not mounted properly you’ll want to remount it.
DISM /remount-wim /mountdir:C:\(mount folder name)
Lastly, you will then want to unmount that .WIM in DISM.
DISM /unmount-wim /mountdir:C:\(mount folder name) /discard
Reboot your computer and now you should be able to delete your c:\winpe_x86 directory.
To see more DISM commands, read Microsoft’s article on “Deployment Image Servicing and Management Command-Line Options.”