Why does Windows keep regenerating unneeded .regtrans-ms files in my user folder?

This is a follow-on question from this one. As concluded in that answer, these files are supposedly registry transaction files - files that should have been merged into the registry at some point and can therefore be safely deleted:

Once Windows has determined that it's "safe" to write the change to registry, it does so, and following that, it will then verify that the change has been made, at which time it will delete the file and move onto other OS tasks. When something in this process fails, you end up amassing these files.

Once you're done analyzing them, any of these .blf or .regtrans-ms files that were created prior to the last system boot can be safely deleted. There's no way they will (or should) be written to the registry, so they're junk.

However, after proceeding to remove these files from my system using Unlocker and then rebooting the PC, I've found that even though Unlocker successfully deleted the files, they were simply regenerated in their original sizes when the PC had booted up (note the updated timestamps):

enter image description here

If, as the answer to the original question claims, these files are indeed simply registry changes that were already pushed to the registry prior to the last reboot, then why is Windows 7 regenerating them as soon as it finds that they're not there?

Is it possible that the changes represented by these "registry transaction" files failed to be written to the Registry, leaving them in a limbo state where they can neither be merged nor deleted, or could it be that something else entirely else is at play here?


Solution 1:

Those are transaction log files. The transaction processor stores a series of log records which allow it to guarantee the entire operation can be completely finished or completely rolled back if it can't be finished, i.e., no half-completed changes. Log record storage (the log file) needs to be preallocated so the log can be efficiently written. The log file doesn't go away when transactions are committed; the space inside it is managed.

The actual logging is controlled by the Common Log File System, described here: https://en.wikipedia.org/wiki/Common_Log_File_System

I imagine the registry subsystem creates the log file as soon as it loads the hive files, though it could be delayed until the first transactional operation on the registry.

Solution 2:

To be clear, those files are used to store pending registry writes that may or may not be from before the last boot. Some of them might be from the current session, and those files will almost certainly be locked by windows to prevent deletion and should not be deleted. If you want to delete some of them, it's up to you to determine which ones are from a previous boot and can be safely deleted.

Additionally, the files may be recreated when an application on the system needs to write to the registry again. This is entirely normal and certainly unavoidable. Applications are almost always writing to the registry for one reason or another. Especially during startup. So, in many cases, these files will be created again as soon as you start Windows.

Honestly, I'm not sure why this bothers you so much. The files are very small and do not take up any appreciable amount of space on the hard drive. They are in a location that you really shouldn't have reason to visit much. And they are, by default, hidden files that you wouldn't see at all if Windows' settings were in their factory state. My advice is to leave them alone and ignore them.