@echo off regedit /ea %Temp%\ChkReg.txt "HKEY_CURRENT_USER\Software\MyPrg-1" if exist %Temp%\ChkReg.txt type %Temp%\ChkReg.txt>reg.reg regedit /ea %Temp%\ChkReg.txt "HKEY_LOCAL_MACHINE\Software\MyPrg-1" if exist %Temp%\ChkReg.txt findstr /v /b /i "REGEDIT4" %Temp%\ChkReg.txt>>reg.reg if exist %Temp%\ChkReg.txt del %Temp%\ChkReg.txt
As far as you can see, first of all we export the necessary keys to ChkReg.txt, than copying data itself to REG file, and then remove the temporary TXT. Hope this script will be useful for you.