Solved

batch file to add/change registry

Posted on 2009-07-13
4
660 Views
Last Modified: 2012-05-07
Please someone help me to create batch file to add following registry.
This has to be batch file, not vbs.

Thanks.
"HKEY_LOCAL_MACHINE\SOFTWARE\ManagementSoftware\4.0.0\WIN\","\\server\CMN\4.0.0\WIN\","REG_SZ"

"HKEY_LOCAL_MACHINE\SOFTWARE\ManagementSoftware\CMN\","\\server\CMN\","REG_SZ"

"HKEY_LOCAL_MACHINE\SOFTWARE\ManagementSoftware\CMN\DBLocation","\\server\CMN\","REG_SZ"

"HKEY_CLASSES_ROOT\Installer\Products\44AFB2215A150C7448D73E8EC48716A0\SourceList\Net\1","\\server\CMN\","REG_EXPAND_SZ"

Open in new window

0
Comment
Question by:kimakabane
4 Comments
 
LVL 2

Expert Comment

by:regnighc
Comment Utility
You cant add the keys using a bat file but you can use a bat file to import a reg file.

Please see here  http://www.robvanderwoude.com/regedit.php
0
 

Author Comment

by:kimakabane
Comment Utility
Thanks.

Is it possible to add registry if it is vbs?
Do you know how to add "CPAU" usage in its vbs file?

I need to let users to run script on network share folder to change registry which domain user have no access.
0
 
LVL 38

Expert Comment

by:Shift-3
Comment Utility
Your information is out of date, regnighc.  Registry entries can be added directly in batch scripts with the reg add command.  Reg.exe is included by default in Windows XP and up.

kimakabane, I don't understand the entries in your original post.  What are the keys, what are the values, and what is the data within those values?
0
 
LVL 3

Accepted Solution

by:
cclassen earned 500 total points
Comment Utility
Shift-3 is correct.  You can use Reg Add to do this in batch.

I took a stab at guessing the values from the strings you have posted and came up with this.  This script will loop through a list of machines (in list.txt; should be in the same directory as the batch file).  If you don't need to run through a list, just use

reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ManagementSoftware\4.0.0" /v "WIN" /t "REG_SZ" /d "\\server\CMN\4.0.0\WIN\"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ManagementSoftware\" /v "CMN" /t "REG_SZ" /d "\\server\CMN\"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ManagementSoftware\CMN\" /v "DBLocation" /t "REG_SZ" /d "\\server\CMN\"
reg add "HKEY_CLASSES_ROOT\Installer\Products\44AFB2215A150C7448D73E8EC48716A0\SourceList\Net\" /v "1" /t "REG_EXPAND_SZ" /d "\\server\CMN\4.0.0\WIN\"


****

for /f %%i in (list.txt) do call :main %%i
goto :eof
 
:main
set vCurrentPC=%1
reg add "\\%vCurrentPC%\HKEY_LOCAL_MACHINE\SOFTWARE\ManagementSoftware\4.0.0" /v "WIN" /t "REG_SZ" /d "\\server\CMN\4.0.0\WIN\"
reg add "\\%vCurrentPC%\HKEY_LOCAL_MACHINE\SOFTWARE\ManagementSoftware\" /v "CMN" /t "REG_SZ" /d "\\server\CMN\"
reg add "\\%vCurrentPC%\HKEY_LOCAL_MACHINE\SOFTWARE\ManagementSoftware\CMN\" /v "DBLocation" /t "REG_SZ" /d "\\server\CMN\"
reg add "\\%vCurrentPC%\HKEY_CLASSES_ROOT\Installer\Products\44AFB2215A150C7448D73E8EC48716A0\SourceList\Net\" /v "1" /t "REG_EXPAND_SZ" /d "\\server\CMN\4.0.0\WIN\"
goto :eof
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now