I want to backup the following info using reg.exe in cmd: Code: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion] "EditionID"="Enterprise" "ProductName"="Windows 8 Enterprise" But if I use the built in export command then it backups all keys & values under CurrentVersion; no way to specify a particular portion. Code: Microsoft Windows [Version 6.2.9200] (c) 2012 Microsoft Corporation. All rights reserved. C:\Users\Tito>reg export "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" D:\backup.reg The operation completed successfully. Please help.
i think the REG.exe or REGEDIT.exe both via command line backup the complete key and subkeys, as you are experiencing. as far as i know physically running regedit going to your key and right click EXPORT is the only way. this link to some VBS code may help: http://www.motobit.com/help/regedit/sa310.htm
reg query 'ProductName' & 'EditionId' entries, and write results to 'Backup.reg' Code: @ECHO OFF SET PRDT=&SET EDTN= ::reg query 'ProductName' & 'EditionId' entries FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName') DO SET PRDT=%%B FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v EditionId') DO SET EDTN=%%B ::write 'Backup.reg' (ECHO Windows Registry Editor Version 5.00 ECHO. ECHO [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion] ECHO "EditionID"="%EDTN%" ECHO "ProductName"="%PRDT%") >Backup.reg
i dont know if anything from this thread i posted some time ago will help you in anyway http://forums.mydigitallife.net/thr...-find-and-replace-and-reimport-a-registry-key
very good I would suggest a small change to Winrar sfx... Path=%temp%\UpDown8 I would change this 'Path' to... Path=%windir%\UpDown8 If 'Backup.reg' saved to '%temp%' location it will most likely be deleted, by Windows Cleanup, CCleaner, Etc.
I had a look at you UpDown8 script. Instead of importing the .reg files, such that it is: Code: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion] "EditionID"="Enterprise" "ProductName"="Windows 7 Enterprise" You can do it internally in the script file by: Code: reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /t REG_SZ /v EditionID /d Enterprise /f>nul reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /t REG_SZ /v ProductName /d "Windows 7 Enterprise" /f>nul the errorlevel codes still apply, 0 success, 1 fail. The /f overwrites the existing values, just as it does when you import a .reg file. you can do the same with the other two files. Not that it really matters, but a Windows based batch script I believe should be named with the .cmd extension.