Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Remove-Item : Cannot remove item because it is being used by another process

The problem is very easy to understand.

Yesterday I have installed en_visual_studio_2015_shell_isolated_x86_dvd_9fda4a05.iso and the file is hanging on my Desktop.

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

When I try to delete it through Remove-Item .\en_visual_studio_2015_shell_isolated_x86_dvd_9fda4a05.iso the Terminal fires back with the error:

Remove-Item : Cannot remove item C:\Users\franc\OneDrive\Desktop\en_visual_studio_2015_shell_isolated_x86_dvd_9fda4a05.iso: The process cannot access the file
'C:\Users\franc\OneDrive\Desktop\en_visual_studio_2015_shell_isolated_x86_dvd_9fda4a05.iso' because it is being used by another process.
At line:1 char:1
+ Remove-Item .\en_visual_studio_2015_shell_isolated_x86_dvd_9fda4a05.i ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\franc\...vd_9fda4a05.iso:FileInfo) [Remove-Item], IOException
    + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand

So I tried to find out what is handling that file:

$handleOut = handle
foreach ($line in $handleOut) { 
        if ($line -match '\S+\spid:') {
            $exe = $line
        } 
        elseif ($line -match 'C:\\Users\\franc\\OneDrive\\Desktop\\en_visual_studio_2015_shell_isolated_x86_dvd_9fda4a05.iso')  { 
            "$exe - $line"
        }
     }

But the answer was:

System pid: 4 \<unable to open process> -  7540: File  (R--)   C:\Users\franc\OneDrive\Desktop\en_visual_studio_2015_shell_isolated_x86_dvd_9fda4a05.iso
System pid: 4 \<unable to open process> -  7B18: File  (RW-)   C:\Users\franc\OneDrive\Desktop\en_visual_studio_2015_shell_isolated_x86_dvd_9fda4a05.iso

I ultimately used Process Explorer and I found out that what is handling the file is OneDrive.

I stopped OneDrive but the problem persists.

Any suggestion?

>Solution :

This is sheerly speculation, but it sounds like you need to unmount the iso: https://www.digitalcitizen.life/mount-unmount-iso-file-explorer/

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading