Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've been having a really strange problem in Windows 7 that's been driving me nuts.

Sometimes when I delete a folder full of random files (and no, not files in the Windows folder) and one of those files is an .exe, the .exe will refuse to delete (which prevents the folder from properly deleting too). Maybe not refuse to delete, but more along the lines of that the .exe disappears when I hit Shift-Del and enter, but if I refresh that folder and/or reopen that folder, the .exe returns, like as though nothing happened. I've tried using utilities like Unlocker to force the OS to let go of the exe file, but Unlocker simply says it'll try to delete the file upon reboot.

Usually when I do run into this, a simple reboot of the OS does the trick (which makes Unlocker doing it on reboot pointless). After I reboot, the OS "lets go" of the exe and allows me to delete it. The problem is, this happens quite often and it drives me absolutely nuts. It prevents certain update utilities that delete an exe and replace it with a new version of the exe from properly working. I've had it screw up my Steam updates a few times where I ended up having to manually force the update through several restarts.

What puzzles me is that there is no rhyme or reason to when the OS refuses to let go of these exe files. They happen on different drives on different folders. My suspicion was Microsoft Security Essentials hanging onto the exe, but even disabling that didn't work, so I'm wondering just what the heck is causing these exes to refuse to delete like that and why restarting the OS allows me to properly delete them. Already did a virus and spyware scan - nothing's in there. This happens with different drives on different SATA controllers and all of them are in good health.

Anyone have any idea what causes this?

Edit: I actually had it happen the other day. Luckily, I had Process Monitor available. It was an exe file. A bit of clarification on what happens when the exe gets "stuck": The exe looks like it deletes, then disappears, but when I close and reopen the folder, it comes back. If at this point, I try to delete it again, it refuses to move and stays in the folder. Shift-Del doesn't work either. Sometimes ithis first part doesn't happen and just immediately refuses to delete.

This time, it was Malwarebytes trying to update itself using the usual update installer wizard. Got a "can't move file" error with it unable to remove mbam.exe. I launched Process Monitor and searched for mbam.exe - showed that explorer.exe for some reason was hanging onto it. I killed off explorer.exe from the Task Manager and restarted it and that did the trick. Windows "let go" of the file and allowed the update process to continue.

Now I understand why a restart fixes this, since obviously this closes Windows Explorer and relaunches it. I bet a logoff would do the trick too. However, this begs the question: what the heck is causing Windows to hang onto these exes?

share|improve this question

3 Answers 3

In Process Explorer, use CTRL+F and type in the name of the executable.

This will identify what is keeping it open, either the executable itself or a virus scanner...

share|improve this answer
    
As I can't exactly force the problem to happen (as there's no rhyme or reason as to what causes it), I'll download this and keep it handy so I can launch it the next time this happens. My suspicion might still be MSE hanging onto it despite turning off the realtime protection, but I'm not sure. I've checked Task Manager to see if the process was still running when this happened before, but the process/exe is not there. It's just weird - the exe keeps coming back after each deletion attempt; it behaves almost similar to Windows File Protection does for the C:\Windows directory. –  White Phoenix Sep 22 '11 at 10:47
2  
@WhitePhoenix: Wait, do you actually see that .exe is gone but returns later? In that case, Process Monitor might come in handy to see what I/O operations are exactly happening... –  Tom Wijsman Sep 22 '11 at 10:48
    
@WhitePhoenix: If it is Windows File Protection, check your event logs. WFP logs an entry when it fires. support.microsoft.com/kb/222193 –  surfasb Sep 22 '11 at 12:07
    
@TomWijsman: See main post for update. –  White Phoenix Sep 24 '11 at 19:30
1  
@WhitePhoenix: If explorer.exe has the executable open, you might want to check for your shell extensions with ShellExView as one might be incorrectly closing files that it opened... –  Tom Wijsman Sep 25 '11 at 1:45
up vote 2 down vote accepted

I know this is a really old question of mines, but this was driving me absolutely nuts.

After a quick Google search with the right keywords, I was able to figure out that the reason why Explorer was hanging onto my executables was because my Application Experience service was disabled. I must have disabled this a long time ago for whatever reason. After enabling it, deleted EXEs stay deleted and I can now update programs without any problems.

I don't know WHY disabling that service caused this problem to happen, but I'm just glad I don't have to worry about executables getting "stuck" anymore.

Source for solution: http://www.sevenforums.com/general-discussion/227681-problem-locked-exe-files.html

share|improve this answer
1  
Thanks man, this fixed the problem. I don't know what Microsoft guys think, but that's not the way OS services should work (and should not). :-( –  Ho1 Jul 23 '13 at 0:58

It is possible that the NTFS Master File Table is in error. See http://www.diydatarecovery.nl/kb_undelete_article.htm for an explanation. My first step would be to check the disk for errors. See http://www.howtogeek.com/howto/windows-vista/guide-to-using-check-disk-in-windows-vista/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.