May-06-2017, 06:09 AM
I've been working on a script for someone and they need the Windows registry backed up before the script is run. I've been using the code below, but I recently noticed that it's not getting all of the registry backup. I added the
check=True
argument to see if it would raise an error, but no error was raised. When I run the command in the regular command prompt window, I end up with a 194MB file. However, when I run the same command using the code below, I end up with a 117MB file. Any suggestions on how the file could be cut short like that?def backup_registry(self) -> None: try: print("Backing up the registry.") cmd = "regedit.exe /a /e " + self.write_path + "EntireRegistry.reg" subprocess.run(cmd, check=True) except subprocess.CalledProcessError: raise