Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Diane
- Posts: 3
- Joined: 12 Sep 2016 21:40
#1
Post
by Diane » 12 Sep 2016 22:37
I explain by example.
I get this output by Backup.Cmd typing the following line :
Regedit /E D:\RegistryBackup\Desktop.Reg HKEY_CURRENT_USER\Control Panel\Desktop
and get following output :
Code: Select all
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothing"="2"
"FontSmoothingGamma"=dword:000003e8
"FontSmoothingOrientation"=dword:00000001
"FontSmoothingType"=dword:00000002
I need to export only "FontSmoothingGamma" & "FontSmoothingOrientation" values.
Still not sure if someone can help me on Regedit commands and switches, but finding no live help I came here.
Will be grateful if someone helps.
Last edited by
Diane on 15 Sep 2016 18:39, edited 1 time in total.
-
Compo
- Posts: 600
- Joined: 21 Mar 2014 08:50
#2
Post
by Compo » 13 Sep 2016 04:18
When you say export, could you please explain the format for which you require the output, and for which OS.
e.g. If you just require the data content for those two values then you don't need to export the entire registry key.
-
Diane
- Posts: 3
- Joined: 12 Sep 2016 21:40
#3
Post
by Diane » 14 Sep 2016 04:57
Compo wrote:When you say export, could you please explain the format for which you require the output, and for which OS.
All that I can say is the exported file has .reg extension.
I have Windows 7 OS.
Kindly help Thank you.
-
Squashman
- Expert
- Posts: 4488
- Joined: 23 Dec 2011 13:59
#4
Post
by Squashman » 14 Sep 2016 08:16
Diane wrote:Compo wrote:When you say export, could you please explain the format for which you require the output, and for which OS.
All that I can say is the exported file has .reg extension.
I have Windows 7 OS.
Kindly help Thank you.
Diane,
What we are trying to determine is if you need to use these values in your batch file or are you really only trying to export just those values. What is your end goal for this registry export? It helps us if we understand what your entire task goal is.
-
Compo
- Posts: 600
- Joined: 21 Mar 2014 08:50
#5
Post
by Compo » 14 Sep 2016 09:12
This should export just those values:
Code: Select all
@Echo Off
Setlocal EnableExtensions DisableDelayedExpansion
(Set RK=HKCU)
(Set SK=\Control Panel\Desktop)
(Set KV1=FontSmoothingGamma)
(Set KV2=FontSmoothingOrientation)
If /I "%CD%\" NEq "%~dp0" PushD "%~dp0"
Reg Export "%RK%%SK%" OutPut.reg /Y >Nul
Set "SK=%SK:\=\\%"
Set "SK=%SK: =\ %"
Set "_="
(For /F "Delims=" %%I In ('Find /V ""^<OutPut.reg') Do (If Not Defined _ (
Set _=T
Echo=%%I&Echo=) Else (
Echo(%%I|FindStr/IR "%SK%]$" 2>Nul && Call Set "_=K"
Call Echo(%%_%%|Find "K">Nul && (
Echo(%%I|FindStr/IR "^\"%KV1: =\ %\"= ^\"%KV2: =\ %\"=" 2>Nul)))
)>NewInput.reg
Del OutPut.reg
EndLocal
Exit/B
…but it's a lot of work, especially as the registry and those values and data can be read directly by a batch script without having or creating a reg file!
-
Diane
- Posts: 3
- Joined: 12 Sep 2016 21:40
#6
Post
by Diane » 15 Sep 2016 18:38
@"Compo"
Wow it works excellent.
Thank you.