The file cannot be deleted. We often encounter this situation. This is because a "behind the scenes" process is calling the file, and deletion can only be achieved by ending the process. So how to locate this process? Usually, we need to use third-party tools such as "Ice Blade". However, it can be easily solved in Windows 7 by using its "Resource Monitor".
Below we simulate the situation where files cannot be deleted. Create a folder named test on the D drive, then run the command prompt (cmd) and locate the command path to the folder directory. At this point, we delete the test folder, and you can see the dialog box shown in Figure 1 pop up, prompting: The operation cannot be completed, the folder or file is opened in another program.
Next we can do this: right-click the Windows 7 taskbar and select the "Start Task Manager" command, click the "Performance" tab in the opened "Windows Task Manager" console window, and then click "Resource Monitor" button to enter the "Resource Monitor" console. Click the "CPU" tab in the console to navigate to the tab page, and then enter "test" in the search box to the right of "Associated handle". At this time, the system will automatically search for the system process associated with the test handle. Search and wait for a while. As shown in the figure, you can see that the searched process is cmd.exe (confirming the situation simulated above). This shows that it is the cmd.exe process that is calling the test folder, which causes the failure to delete the folder. Right-click the process and select the "End Process" command to pop up a warning dialog box. After confirmation, the cmd.exe process can be ended.
Finally, delete the test folder and you can see that the folder is successfully deleted. Although the above is a simulated scenario, it is actually exactly the same as the real scenario. As long as you apply it flexibly, problems like this will no longer bother you.
The above steps are a bit troublesome, so how can we quickly call the resource monitor? In the process list, you can see that the process name is perfmon.exe, but this is the performance monitor, and the resource monitor cannot be found in it. Later, considering the problem of command line parameters, a parameter /res was added. After testing, everything was normal, so I created a shortcut pointing to "C:WindowsSystem32perfmon.exe /res". Use this shortcut to achieve quick calls.