I am trying to create a script to make an edit to the window’s registry. As a fall back, I want to create a back up of the registry and save it in the working directory (or some other directory, but that is for later). Is there a way to use the power of python to backup the registry first?
So far the only way I have found to do this might be a call out to reg.exe, but I was looking for something more native to python itself.
Thanks!
The registry is a deeply Windows-centric construct, though I have not done any research on the subject, I would bet that there is no “native” way for backing up the registry in Python. I think you already have your answer and creating a process in Python and letting it run Reg Export is the best way to accomplish what you want.
However, if for some reason you don’t want to run Reg.exe or invoke any external processes, I recommend that you write and save every registry entry before you edit it into a .reg file like this:
This approach will ensure that you don’t rely on any external utility and is the nearest thing to a “native” registry backup in Python.