Files that are currently opened or in use in Windows cannot be moved or deleted until they are closed. Most of the time closing the associated program would do the job but sometimes it still won’t work because its mapped to the memory or protected by another process. To solve this problem, most of us would simply rely on a third party software such as FileASSASSIN, LockHunter, IObit Unlocker, BlitzBlank and etc that is capable of detecting locked files and attempt to unlock them for further actions. Unlocking locked files has its own risk that can possibly cause crashes on the operating system.
The safer solution is to mark the file for deletion on the next reboot and the Microsoft Windows operating system has made it easy for developers because it comes with a MoveFileEx API to delete or rename/move files the next time the system boots up. This task is performed by reading a registry entry called PendingFileRenameOperations located at HKLM\SYSTEM\CurrentControlSet\Control\Session Manager. Do note that the PendingFileRenameOperations registry key will not exist unless there is a pending operation.
If you do not like messing with the Windows registry, here we have a few free tools that can help you read the PendingFileRenameOperations keys and display the list of pending file operations. Some of them have the capability of allowing you to schedule move and delete commands for the next reboot.
(more…)






