PC Review


Reply
Thread Tools Rate Thread

Updating registry via REG files

 
 
Gordon
Guest
Posts: n/a
 
      22nd Apr 2005
I'm attempting to setup a generic profile file (REG file) that I can
use to simplify my software setup tasks, in this case, AutoCAD 2005.

In an ARG file (an AutoCAD user profile which is nearly identical in
structure to a REG file) that is dumped for a specific user after
AutoCAD is setup for example, you'll see registry KEY entries similar
this one:

[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-301:409\Profiles\Gordon\Menus]

Now when making a batch file script (*.bat file), I know I can use
%USERNAME% to plugin the current user name for batch file commands.



Can someone more knowledgable than I tell me if this will work:

[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-301:409\Profiles\%USERNAME%\Menus]


It would sure be cool (and save me a bunch of time) if I could create
one master REG file that could be applied to any given user, without
having to manually modify the REG file for each user, right after I
finish the Acad install, and have all my network pointers and custom
menus in place. This trick could be applied to other software as
well....

How do I get a registry key entry in a REG file, like the one above, to
plugin the user name?


Or, maybe I'm going about this the wrong way.... Comments welcome!

Thanks
Gordon

 
Reply With Quote
 
 
 
 
Dave Patrick
Guest
Posts: n/a
 
      22nd Apr 2005
All air code but something like this VBScript may work.

Dim WshShell, user
Set WshShell=WScript.CreateObject("WScript.Shell")

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
user = objComputer.UserName
Next

WshShell.RegWrite "HKCU\Software\Autodesk\" _
& "AutoCAD\R16.1\ACAD-301:409\Profiles\" _
& user & "\Menus", "SomeValue", REG_SZ"

Set WshShell=Nothing

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

"Gordon" wrote:
| I'm attempting to setup a generic profile file (REG file) that I can
| use to simplify my software setup tasks, in this case, AutoCAD 2005.
|
| In an ARG file (an AutoCAD user profile which is nearly identical in
| structure to a REG file) that is dumped for a specific user after
| AutoCAD is setup for example, you'll see registry KEY entries similar
| this one:
|
|
[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-301:409\Profiles\Gordon\Menus]
|
| Now when making a batch file script (*.bat file), I know I can use
| %USERNAME% to plugin the current user name for batch file commands.
|
|
|
| Can someone more knowledgable than I tell me if this will work:
|
|
[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-301:409\Profiles\%USERNAME%\Menus]
|
|
| It would sure be cool (and save me a bunch of time) if I could create
| one master REG file that could be applied to any given user, without
| having to manually modify the REG file for each user, right after I
| finish the Acad install, and have all my network pointers and custom
| menus in place. This trick could be applied to other software as
| well....
|
| How do I get a registry key entry in a REG file, like the one above, to
| plugin the user name?
|
|
| Or, maybe I'm going about this the wrong way.... Comments welcome!
|
| Thanks
| Gordon
|


 
Reply With Quote
 
 
 
 
Dave Patrick
Guest
Posts: n/a
 
      22nd Apr 2005
Should have been;

Dim WshShell, WshSysEnv, user
Set WshShell = CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("Process")

user = WshSysEnv("username")

WshShell.RegWrite "HKCU\Software\Autodesk\" _
& "AutoCAD\R16.1\ACAD-301:409\Profiles\" _
& user & "\Menus", "SomeValue", REG_SZ"

Set WshShell=Nothing
Set WshSysEnv=Nothing

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect


 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      23rd Apr 2005
In microsoft.public.win2000.registry Gordon wrote:

> I'm attempting to setup a generic profile file (REG file) that I
> can use to simplify my software setup tasks, in this case,
> AutoCAD 2005.
>
> In an ARG file (an AutoCAD user profile which is nearly
> identical in structure to a REG file) that is dumped for a
> specific user after AutoCAD is setup for example, you'll see
> registry KEY entries similar this one:
>
> [HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-301:409\P
> rofiles\Gordon\Menus]
>
> Now when making a batch file script (*.bat file), I know I can
> use %USERNAME% to plugin the current user name for batch file
> commands.


By having a batchfile expand the variable and write it to a .REG
file first. Then merge the reg file.


> Can someone more knowledgable than I tell me if this will work:
>
> [HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.1\ACAD-301:409\P
> rofiles\%USERNAME%\Menus]
>
>
> It would sure be cool (and save me a bunch of time) if I could
> create one master REG file that could be applied to any given
> user, without having to manually modify the REG file for each
> user, right after I finish the Acad install, and have all my
> network pointers and custom menus in place. This trick could be
> applied to other software as well....


If you want to distribute a batch file (that creates and merges a
REG file on-the-fly)...

> How do I get a registry key entry in a REG file, like the one
> above, to plugin the user name?
>
>
> Or, maybe I'm going about this the wrong way.... Comments
> welcome!


Simplified demo:
======== demo.cmd ==========
@echo off
echo/REGEDIT4 >%temp%\demo.reg
echo/ >>%temp%\demo.reg
echo/[HKEY_CURRENT_USER\_TEST_\%USERNAME%] >>%temp%\demo.reg
echo/ >>%temp%\demo.reg

%systemroot%\regedit.exe /s %temp%\demo.reg
DEL /q %temp%\demo.reg
=============================

It may also be possible to pre-expand a variable in batch, then use
reg.exe with the expanded string.

All assume Keys or REG_SZ strings.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How add permission in 1 key of registry? via .vbs or .reg caiofs@gmail.com Windows XP Setup 1 5th Sep 2005 03:34 PM
Updating registry via REG files Gordon Microsoft Windows 2000 Registry 3 23rd Apr 2005 02:56 AM
Adding a TCP/IP port to the registry via reg.exe (REG ADD) Mike Kiser Microsoft Windows 2000 Registry Archive 0 14th Nov 2003 05:03 PM
Adding a TCP/IP port to the registry via reg.exe (REG ADD) Mike Kiser Microsoft Windows 2000 Registry 0 14th Nov 2003 05:03 PM
Adding a TCP/IP port to the registry via reg.exe (REG ADD) Mike Kiser Microsoft Windows 2000 Registry Archive 0 14th Nov 2003 05:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:48 AM.