Windows File Protection (WFP), first introduced with Windows Millennium, (Windows Vista uses something called Windows Resource Protection) is a built system that detects the replacement and overwriting of system files, caused by malware or badly written software, if system files where to be erased it would cause continuous operating system crashes and even prevent it from booting up. Windows File Protection can not be turned off by users (unless using a kernel debugger).
After uninstalling a program you will find junk files left behind due to a substandard uninstaller, many times those files can not be manually erased with Windows complaining that they are locked, another explanation for locked files is corrupted files or changed file permissions, it is also possible that folders pointing to an invalid name or to an extremely long path can give you an error when you attempt to erase them, and there are malware files locking themselves in to prevent you from erasing infected files.
Erasing locked files
FileExile is an easy to use open source program that will get rid of hard to erase folders and files, all you have to do is to locate the hard to erase file or folder, select it and click on “Delete“, you will not even need to reboot your computer. FileExile allows you to log all operations to keep track of what has been erased.
I have also managed to erase locked files using a simple secure data shredding application this gets around Windows File Protection most times and circumvents Windows recycle bin.
garrydam
Another software alternative that works is “LongPathTool” for error messages: Cannot read from source file or disk, there has been a sharing violation, cannot delete file or folder, the file name you specified is not valid or too long, the source or destination file may be in use and many other file managing errors.
barry41
You can use Long Path Tool, for such issues, it works good I will say.