@echo off rem Dump multiple registry keys to disk Registry keys to disk set key_1_=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run set key_2_=HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run rem set this to the lower bound of the array set LBOUND=1 rem set this to the upper bound of the array set UBOUND=2 set TXTDUMP=C:\RegDump for /l %%j in (%LBOUND%,1,%UBOUND%) do ( for /f "delims== tokens=2" %%i in ('set key_%%j_') do regedit /e %TXTDUMP%%%j.txt %%i ) pause