Computing.Net > Forums > Programming > Batch script and two .reg files.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch script and two .reg files.

Reply to Message Icon

Name: P.NOiZE
Date: July 16, 2009 at 20:38:59 Pacific
OS: Windows XP/Vista
Subcategory: Batch
Comment:

Hello!

I'm trying to create a batch file that will parse through a "foo.reg" file to create a new "bar.reg" file.

Here's an example of a "foo.reg" file:

---
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\MSConfig\startupreg\AVG8_TRAY]
"item"="AVG8_TRAY"
"command"="C:\\PROGRA~1\\AVG\\AVG8\\avgtray.exe"
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\MSConfig\startupreg\LightScribe Control Panel]
"item"="LightScribe Control Panel"
"command"="C:\\Program Files\\Common Files\\LightScribe\\LightScribeControlPanel.exe -hidden"
"hkey"="HKEY_CURRENT_USER"
"key"="Run"
---

...and here's how I would like the output "bar.reg" file to look:

---
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"AVG8_TRAY"="C:\\PROGRA~1\\AVG\\AVG8\\avgtray.exe"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"LightScribe Control Panel"="C:\\Program Files\\Common Files\\LightScribe\\LightScribeControlPanel.exe -hidden"
---

I have a VERY basic understanding, but just can't translate it into a batch file.

- ignore what is in the brackets [] including the brackets themselves

- for every instance of "hkey"="HKLM", output [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]

- for every instance of "hkey"="HKEY_CURRENT_USER", output [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]

- on the next line, output the string that after "item"= (with the quotes) and make it equal to the string that is after "command"= (with the quotes)

Any input would be greatly appreciated!



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 17, 2009 at 05:58:12 Pacific
Reply:

hmm...

Seems like the "item"= bit is BEFORE the "hkey"= ; isn't it?


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: P.NOiZE
Date: July 17, 2009 at 07:10:40 Pacific
Reply:

Yes. I see that as being a bit of a problem since I can only see
the batch file iterating through the .reg file one line at a time from
the beginning of the file to the end of the file.

Would a VBScript be more suitable?


0

Response Number 3
Name: Mechanix2Go
Date: July 17, 2009 at 11:49:38 Pacific
Reply:

Is the file strictly as posted, ie a title and blocks of 5 lines each separated by blanks?


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 4
Name: P.NOiZE
Date: July 17, 2009 at 14:37:36 Pacific
Reply:

I wish I could attach the file. I've copy and pasted it without any formatting below, but there are line breaks where there shouldn't be.


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\Adobe Reader Speed Launcher]
"item"="Adobe Reader Speed Launcher"
"command"="\"C:\\Program Files\\Adobe\\Reader 
8.0\\Reader\\Reader_sl.exe\""
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\AdobeUpdater]
"item"="AdobeUpdater"
"command"="\"C:\\Program Files\\Common 
Files\\Adobe\\Updater5\\AdobeUpdater.exe\""
"hkey"="HKEY_CURRENT_USER"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\amBX Daemon]
"item"="amBX Daemon"
"command"="\"C:\\Program Files\\amBX\\Control 
Panel\\amBXDaemon.exe\""
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\amBX System Tray Application]
"item"="amBX System Tray Application"
"command"="C:\\Program Files\\amBX\\Gaming 
FXGen\\win32\\amBXFxGen.exe"
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\AVG8_TRAY]
"item"="AVG8_TRAY"
"command"="C:\\PROGRA~1\\AVG\\AVG8\\avgtray.exe"
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\EKIJ5000StatusMonitor]
"item"="EKIJ5000StatusMonitor"
"command"="C:\\WINDOWS\\System32\\spool\\DRIVERS\\
W32X86\\3\\EKIJ5000MUI.exe"
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\EVEMon]
"item"="EVEMon"
"command"="\"C:\\Program Files\\EVEMon\\EVEMon.exe\" -
startMinimized"
"hkey"="HKEY_CURRENT_USER"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\Launch LCDMon]
"item"="Launch LCDMon"
"command"="\"C:\\Program Files\\Common 
Files\\Logitech\\LCD Manager\\lcdmon.exe\""
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\Launch LGDCore]
"item"="Launch LGDCore"
"command"="\"C:\\Program Files\\Common 
Files\\Logitech\\G-series Software\\LGDCore.exe\" 
/SHOWHIDE"
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\LightScribe Control Panel]
"item"="LightScribe Control Panel"
"command"="C:\\Program Files\\Common 
Files\\LightScribe\\LightScribeControlPanel.exe -hidden"
"hkey"="HKEY_CURRENT_USER"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\Logitech Hardware Abstraction 
Layer]
"item"="Logitech Hardware Abstraction Layer"
"command"="KHALMNPR.EXE"
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\NvCplDaemon]
"item"="NvCplDaemon"
"command"="RUNDLL32.EXE 
C:\\WINDOWS\\system32\\NvCpl.dll,NvStartup"
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\NvMediaCenter]
"item"="NvMediaCenter"
"command"="RUNDLL32.EXE 
C:\\WINDOWS\\system32\\NvMcTray.dll,NvTaskbarInit"
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\NVMixerTray]
"item"="NVMixerTray"
"command"="\"C:\\Program Files\\NVIDIA 
Corporation\\NvMixer\\NVMixerTray.exe\""
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\SmartGuardian]
"item"="SmartGuardian"
"command"="C:\\Program Files\\ITE\\Smart 
Guardian\\ITESmart.exe"
"hkey"="HKLM"
"key"="Run"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared 
Tools\MSConfig\startupreg\SoundMan]
"item"="SoundMan"
"command"="SOUNDMAN.EXE"
"hkey"="HKLM"
"key"="Run"

Basically:

Line 1[...]
Line 2"item"="..."
Line 2"command"="..."
Line 3"hkey"="..."
Line 4"key"="..."

Hope this helps!


0

Response Number 5
Name: Mechanix2Go
Date: July 17, 2009 at 15:56:05 Pacific
Reply:

Best bet is to ZIP it up and use:


www.sendthisfile.com


=====================================
If at first you don't succeed, you're about average.

M2


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch script and two .reg files.

batch script to pick thelatest file www.computing.net/answers/programming/batch-script-to-pick-thelatest-file/16427.html

Batch Script To FTP a file www.computing.net/answers/programming/batch-script-to-ftp-a-file/17008.html

Batch merge two txt files www.computing.net/answers/programming/batch-merge-two-txt-files/18956.html