Impossible to delete a file in Windows 7 (2)

21,534

Solution 1

For files that are locked by another open process, I had most success using Unlocker.

Just be careful when installing it, because the developer chose to add a toolbar installation to the install process. Just select "Advanced" in the installation and uncheck all the options.

After installed, just right-click the file and select "Unlocker". You'll see all the process current using the file. All you have to do is select the "Erase" option in the selection box and click "Unlock All".

Solution 2

Since the file is in use by the system process (ID=4), you cannot kill it to free the lock.

Boot from a live CD of your choice (ubuntu for instance), and mount your hard disk. delete the file, and reboot into windows.

Solution 3

In the past I've used Process Explorer to find the handle that is preventing a delete. Download it here: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Open it up and hit "Find" and then "Find Handle or DLL"

You can probably just type iso in the search box. If it finds a program using the iso highlight it and then you'll see it appear in the main window on the lower section. From there just right click the handle and choose close. Worked for me in the past so hopefully it helps you.

Cheers!

Solution 4

This process is being run under system process. What you can do is use psexec from: http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

Then start cmd under system account: psexec -i -s cmd

After that you can use interactive cmd shell to kill the process that is having a lock on the file: taskkill /PID 4, if this fails you can try adding /F (force) switch.

And you delete the file: del /F .\ArcGIS_Desktop_101_129026.iso

This is a "brute force" method so hopefully you know what you are doing.

Share:
21,534

Related videos on Youtube

geotheory
Author by

geotheory

Researcher of GIS, spatial analysis and urban studies at the Centre for Advanced Spatial Analysis, University College London.

Updated on September 18, 2022

Comments

  • geotheory
    geotheory over 1 year

    I'm aware of similar posts on this, but they haven't fixed my issue. I have an .iso installation file previously mounted with MagicDisc that I am now unable to delete. I have of course unmounted the file and shut down MagicDisc. I've also rebooted in safe mode, tried deleting with Administrator privileges, tried deleting by command line, and nothing works. Very grateful for suggestions on how to retire this resilient file.

    In Explorer the error message is:

    enter image description here

    By command line the error is:

    PS C:\users\Robin\Downloads> del .\ArcGIS_Desktop_101_129026.iso
    del : Cannot remove item C:\users\Robin\Downloads\ArcGIS_Desktop_101_129026.iso: The process cannot access the file
    'C:\users\Robin\Downloads\ArcGIS_Desktop_101_129026.iso' because it is being used by another process.
    At line:1 char:1
    + del .\ArcGIS_Desktop_101_129026.iso
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : WriteError: (C:\users\Robin\..._101_129026.iso:FileInfo) [Remove-Item], IOException
        + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
    PS C:\users\Robin\Downloads> del *.iso
    del : Cannot remove item C:\users\Robin\Downloads\ArcGIS_Desktop_101_129026.iso: The process cannot access the file
    'C:\users\Robin\Downloads\ArcGIS_Desktop_101_129026.iso' because it is being used by another process.
    At line:1 char:1
    + del *.iso
    + ~~~~~~~~~
        + CategoryInfo          : WriteError: (C:\users\Robin\..._101_129026.iso:FileInfo) [Remove-Item], IOException
        + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
    PS C:\users\Robin\Downloads>
    

    Appendum

    enter image description here

    • Frank Thomas
      Frank Thomas over 10 years
      try searching for the file in Process Explorer and see what process has it locked. if its not a system process you may be able to kill it, delete the file, and reboot.
    • geotheory
      geotheory over 10 years
      I assume you mean in Task Manager. I'm not sure how to identify which process is using the file. The iso doesn't appear itself anywhere (even with Show processes from all users ticked and System processes being visible.
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 10 years
      Out of all the answers on the "similar posts" you went through, exactly what did you try already?
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 10 years
    • geotheory
      geotheory over 10 years
      The one linked above and this. The others seem not to apply for one reason or another. The preferable solution would be to kill the process using it.
    • geotheory
      geotheory over 10 years
      That's a bit lazy @techie007. It can't be a duplicate of all of these. So make your case against a specific one, and if it is I'll close the question.
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 10 years
      The first one is what I chose to mark it as a duplicate of, the others are related/dupes for your reference. Sorry if you think that's being "lazy".
    • Ramhound
      Ramhound over 10 years
      @geotheory - This problem isn't unique to a specific version of Windows. Besides you don't get to decide if its a duplicate the community does. Have you used Process Explorer to determine what process is preventing you from removing the file? I see no mention of you using any tools in you question, responses to comments might, but the question should have the information also.
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 10 years
      As I asked back a while ago, explain exactly what you've tried already, and what your results were. So far, all the answers given here are in the (various) questions marked as possible duplicates; if you can show us that nothing else in those dupes covers your situation then it might be worth leaving open.
    • geotheory
      geotheory over 10 years
      @Ramhound point taken about community decision. But despite this not being unique, it seems to me a bit unreasonable to expect everyone to assume that's the case. techie007 please be my guest and vote to close it.
    • slhck
      slhck over 10 years
      Just FYI, we close questions as duplicates in order to point people to an answer. Not necessarily because they're absolutely the same questions. Since Unlocker solved it for you, and it's mentioned all over the place, I think we can safely close this…
    • geotheory
      geotheory over 10 years
      Then you perhaps may want to flag up there about the additional spy/bloatware issue with Unlocker.
  • geotheory
    geotheory over 10 years
    0 matching items sorry @mark-brak no luck with this method (although the software does look handy)
  • Frank Thomas
    Frank Thomas over 10 years
    @geotheory: did you run process explorer as admin, and confirm that its showing processes from all users?
  • geotheory
    geotheory over 10 years
    Actually as admin it does find the file (see appendum image above). But killing the process still fails (same error message), and right-clicking the file in the window below and choosing Close Handle returns the error Error opening process: the handle is invalid. Any further suggestions?
  • Ramhound
    Ramhound over 10 years
    This seems like the best option.
  • mark brak
    mark brak over 10 years
    If you pop in your Windows 7 disc you can boot into the repair menu and delete the file from the command prompt. Here is a step by step to boot to this menu. The command prompt part finally appears in step 7. This will save you from having to download a linux boot cd. pcsupport.about.com/od/toolsofthetrade/ss/…
  • geotheory
    geotheory over 10 years
    Already fixed now, but this looks handy in future. Much preferable to installing software solutions - unlike the spyware that has just infected my system :(
  • geotheory
    geotheory over 10 years
    Your link is a 404
  • geotheory
    geotheory over 10 years
    I did in the end use this solution, but I didn't get an option to not install the toolbar stuff, and I have ended up with spyware attack. Nevertheless it has removed the file.
  • Ramhound
    Ramhound over 10 years
    @geotheory - I don't believe the real Unlocker file has spyware connected to it. Where did you download it from exactly?
  • JoselitoBanzai
    JoselitoBanzai over 10 years
    I'm really sorry to hear that, I should not have recommended any software that contains Malware in the installation. I did however uninstall and reinstall Unlocker just to make sure there was a way to not install the toolbar, it was on the third page of the installation. I suppose I'll not be recommending it anymore. I've been using it for years, but just recently noticed they added the toolbar install. I'll install the toolbar on a VM machine and see if i can find a good tutorial to remove it.
  • geotheory
    geotheory over 10 years
    Now not sure where, probably the same place as this chap because I got the same 'Delta' software. Subsequent virus check then found 3 spyware files, although I guess strictly speaking I've now deleted any evidence of their origin.
  • geotheory
    geotheory over 10 years
    The process outlined by 'gringo_pr' here seems to have done a pretty good job of cleaning my system.
  • fig
    fig over 6 years
    Still says "Access is denied" for me :(
  • user10089632
    user10089632 over 6 years
    That link, generated the following message from Bitdefender : Reported Unwanted Software Page! This web page at www.emptyloop.com has been reported to contain unwanted software and has been blocked based on your security preferences. Unwanted software pages try to install software that can be deceptive and affect your system in unexpected ways.
  • Jason
    Jason about 5 years
    Interesting ideas, but System process cannot be killed, and psexec under System still could not delete the file...