Share via

File handles remain open, preventing deletion.

Anonymous
2010-10-05T16:13:03+00:00

This happens most frequently when running programs and subsequently deleting them, such as when Steam updates itself or I rebuild a C++ program, but occurs occasionally with other files as well. For example, when Firefox downloads files it saves a *file*.*ext* place holder and places the data as it is downloaded into a *file*.*ext*.part file. At the end of the download, Firefox sometimes fails to delete the placeholder and replace it with the *.part file. This is NOT a bug with Firefox.

To reproduce the problem without fail:

  1. I run one of my programming projects (I am using Visual C++ 2008 Express, by the way. Not that it matters much in this case though :P).
  2. Exit the program.
  3. *Optional* Shift-Right Click the output program and click Delete. It appears to be successful, but if you refresh the folder view you find a phantom file that you cannot manipulate.
  4. Try to Clean or Rebuild Solution.
  5. Receive the error:
  6. 1>------ Rebuild All started: Project: Win32 ScreenSaver, Configuration: Release Win32 ------

1>Deleting intermediate and output files for project 'Win32 ScreenSaver', configuration 'Release|Win32'

1>Win32 ScreenSaver : error PRJ0008 : Could not delete file 'C:\Users\SilentDude56k\Desktop\Screensaver\Win32_ScreenSaver\Release\Win32 ScreenSaver.scr'.

1>Make sure that the file is not open by another process and is not write-protected.

1>Win32 ScreenSaver - 1 error(s), 0 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

A workaround for this problem is to send the program to the Recycle Bin (omit pressing the Shift key when deleting) before cleaning/rebuilding. I can rebuild without any problems if I do this first.

I am using an Administrator account. My system is clear of any viruses, adware, etc. I have all the latest drivers for my hardware. I am running a genuine copy of Windows 7 Enterprise 64-bit. The paths to these files are far fewer than 260 characters in length as well. Interestingly this problem does not occur on my laptop, which is also running Windows 7 Enterprise 64-bit.

Running Process Explorer and searching for the "Win32_ScreenSaver" handle brings up a result under System. The phantom file disappears once the handle closes. This usually takes a couple of minutes after attempting to delete it with either a Shift-Right Click or a Clean/Rebuild Solution.

A list of what I've tried so far:

  1. Disabling all startup programs and all non-essential services, including ones from Microsoft. The problem is still there.
  2. Uninstalling all hardware drivers. The problem is still there.
  3. Booting into safe mode. This works. The file handle closes immediately upon exiting the program and I can successfully delete it.

I hope all of this information is helpful rather than bothersome. Thank you for your time. I hope we can solve this problem :)

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2010-10-15T18:23:48+00:00

Hi SilentDude56k,

We have tried most of the troubleshooting steps and still the issue is not fixed. At this point, I would suggest you to post your query in TechNet Forums for better support.

Windows 7 IT Pro Forums > Windows 7 Performance

Hope this helps.

Thanks and Regards, Santosh Y – Microsoft Support

Visit our **Microsoft Answers Feedback**Forum and let us know what you think.

Was this answer helpful?

0 comments No comments

11 additional answers

Sort by: Most helpful
  1. Anonymous
    2010-10-11T02:02:42+00:00

    Sorry for the lack of replies, I've been busy with school. I'll try this tomorrow.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-10-07T18:15:58+00:00

    Hi SilentDude56k,

    I would suggest you to try the Diagnostic Startup mode using the System Configuration Utility and check if it helps and let us know the results:

    Using System Configuration - To start Windows in Diagnostic startup mode

    Hope this helps.

    Thanks and Regards, Santosh Y – Microsoft Support

    Visit our **Microsoft Answers Feedback**Forum and let us know what you think.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-10-07T02:30:06+00:00

    Hello, and thank you for your reply. Unfortunately I have already followed all of those instructions to the letter with no luck. Just to make sure, I just followed all of the instructions again. File handles are still not closing properly. Doing a clean boot does not resolve the problem but booting into safe mode still does. If there is any more information I can give you, please let me know.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2010-10-06T13:10:07+00:00

    Hi SilentDude56k,

    As the issue is not occurring in safe mode, I would suggest you to try clean boot and check if it helps. Also, make sure that you follow the steps as in the article link instead of disabling the services by choosing them individually:

    **How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7**(Step 1: Perform a clean boot)

    If your issue is resolved after performing Clean Boot, then follow the steps mentioned in the following KB article to narrow down the exact source: **http://support.microsoft.com/kb/929135**

    Also, see the section on how return your computer to a Normal startup mode by following the steps under “Reset the computer to start as usual”, after performing the clean boot troubleshooting.

    Hope this helps.

    Thanks and Regards, Santosh Y – Microsoft Support

    Visit our **Microsoft Answers Feedback**Forum and let us know what you think.

    Was this answer helpful?

    0 comments No comments