Sometimes it may happen that you try to delete something from your computer but you will not be able to do so and an error message will appear stating- "Unable to delete; folder is in use by Explorer.exe". You won't be able to completely remove the directory unless you stop the browsing process first. Follow these simple processes first to stop the browsing process and then delete the file from Command Prompt.
Fix-1 Delete folder using CMD- command
Finish the Explorer process and then delete the folder from Command Prompt.
1. First, press Windows key + E to access File Explorer.
2. When the File Explorer window pops up, navigate to the problematic folder.
3. Note the path to the file from the address bar.
4. Close “cmd”In the Search box next to the Windows icon.
5. So what you need to do is do it right click over it "Command Prompt"In the search result with elevated privileges and choose"Run as administrator".
6. Minimize Command Prompt window. We will use it later.
7. Now press Tasto Windows + R to open the Run window.
8. To open the Resource Overseer file, generally o copy paste and hit enter.
9. On the right side of the Resource Watcher window, in the 'Associated Handles' panel, you need to type the name of the problematic file (for us it is - "7 zip").
10. Now, right click over it "explorer.exe"And then click"End of the process".
The explorer process will be finished. You will not be able to use it to delete the folder.
12. Now, maximize Command Prompt window.
13. Come on, copy this command and paste in Command Prompt window and change it to folder path, then press Enter to run it.
rd / s
[NOTES– Replace the <folder path> with the location of the problematic folder you noted. For us, the command will look like something like this- “rd /s C:Program Files7-Zip“.]
This should remove the folder from your computer.
Restart your computer.
Fix-2 Usa Process Explorer-
Process Explorer is a tool provided by Microsoft that allows a deeper look into the detection of any associated process that is preventing a particular service on your computer.
1. At first you need to download Process Explorer.
2. Once the file is downloaded, you need to do it extract the "Processexplorer” file zip.
3. After that, you need to go to the location where you just extracted the zip file.
4. Hence, double click on the "procexp64".
In case you are using 32 bit Windows 10, you should run “procexp” on your computer).
5. When the Process Explorer file window appears on your computer, click "Find"
6. Next, simply click on "Find the handle or DLL…".
7. As the Process Explorer Search panel opens, enter the problematic file name next to 'Sottostringa handle or DLL:'.
(For us it is "7 zip").
8. Then click on “Research“To start the research process.
9. You have to wait a while.
10. Once the search process is finished, the related process will be highlighted in the File Process Explorer window.
11. After that, right click on the "explorer.exe"Process and click"Close the handle“To end the process.
After doing all this, close the Process Explorer window.
Again, try deleting the file / folder again using cmd. This time it will be deleted without further problems.
Your problem will be solved.