Trouble deleting c:\winpe_x86 directory – DISM

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

Step 1

Launch CMD.

Step 2


DISM /Cleanup-Wim

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.

Step 3

If it still isn’t fixed by running the above, you will need to display a list of the mounted WIMS.

DISM /Get-MountedWimInfo

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.

Dism Remount
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”.

Dism Mount

Step 4

If it’s not mounted properly you’ll want to remount it.

DISM /remount-wim /mountdir:C:\(mount folder name)

Dism Remount Wim

Step 5

Lastly, you will then want to unmount that .WIM in DISM.

DISM /unmount-wim /mountdir:C:\(mount folder name) /discard

unmount a .wim file

Step 6

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.”

You may also like:

Sysprep a Windows 7 Machine – Start to Finis... This is the old version, please see the new Sysprep a Windows 7 Machine – Start to Finish V2. Note - I highly recommend creating a boot or rescue d...
WinPE 3.1 Scripts WinPE 3.1 Scripts This latest version was compiled on September 27th, 2012. This is the third update to our WinPE scripts. Please read our tutorial o...
Copy Taskbar Icons Windows 7 Sysprep This is the old version, please see the new Copy Taskbar Icons Windows 7 Sysprep v2. Ok, you can thank a colleague of mine (Dinyero Johnson) for th...
Sysprep Windows 7 – Third Party Anti-Virus I have run into about 20-30 people over the last couple weeks that were having trouble sysprepping and they all narrowed it down to the same thing; th...
Install WAIK supplement for Windows 7 SP1 WAIK Supplement These are instructions for installing the new The Windows Automated Installation Kit (AIK) for Windows 7 SP1. This is assuming that y...
  • Craig S.

    Hi, Brian. Thanks so much for this article. This is exactly the situation I’m in, but even after following the steps above, I’m getting errors. Step 2 DISM /Cleanup-Wim terminates normally, but when I do Step 3, I get the message “No mounted images found” (neither of the two options you list in Step 3 covers this). I tried to remount the image to the same folder, but then I get an error message telling me I cannot mount an image to a non-empty directory. So, I’m stuck in a loop here. Any ideas on how I can unlock these files so I can delete the Winpe_x86 directory and subdirs? Thanks for any help. I’d really appreciate it!