Modifying registry

  • Thread starter Thread starter Andy Welcomer
  • Start date Start date
A

Andy Welcomer

Hello Everyone,

I have a fun one here that I can't figure out.


I need to write script that edits keys in the registry. My regedit command
calls a file that has the following entries in it

[HKEY_CURRENT_USER\Software\Hummingbird\Connectivity\8.00\Exceed]
***"EB"=REG_SZ:C:\Documents and Settings\"%username%"\Application
Data\Hummingbird\Connectivity\8.00\Accessories\EB\***
"FontDir"=REG_SZ:D:\Program Files\Hummingbird\Connectivity\8.00\Exceed\Font\
"HomeDir"=REG_SZ:D:\Program Files\Hummingbird\Connectivity\8.00\Exceed\
"InfoDir"=REG_SZ:D:\Program Files\Hummingbird\Connectivity\8.00\Exceed\Info\
***"UserDir"=REG_SZ:C:\Documents and Settings\%username%\Application
Data\Hummingbird\Connectivity\8.00\Exceed\***


The ones surrounded by *** are the ones that don't work. I'm pretty sure
its because I tried to use %username%. How do I fix this?

Thank you in advance

Andy
 
In order to expand variables from the registry you must use type
Reg_Expand_Sz

--
Regards,

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


:
| Hello Everyone,
|
| I have a fun one here that I can't figure out.
|
|
| I need to write script that edits keys in the registry. My regedit
command
| calls a file that has the following entries in it
|
| [HKEY_CURRENT_USER\Software\Hummingbird\Connectivity\8.00\Exceed]
| ***"EB"=REG_SZ:C:\Documents and Settings\"%username%"\Application
| Data\Hummingbird\Connectivity\8.00\Accessories\EB\***
| "FontDir"=REG_SZ:D:\Program
Files\Hummingbird\Connectivity\8.00\Exceed\Font\
| "HomeDir"=REG_SZ:D:\Program Files\Hummingbird\Connectivity\8.00\Exceed\
| "InfoDir"=REG_SZ:D:\Program
Files\Hummingbird\Connectivity\8.00\Exceed\Info\
| ***"UserDir"=REG_SZ:C:\Documents and Settings\%username%\Application
| Data\Hummingbird\Connectivity\8.00\Exceed\***
|
|
| The ones surrounded by *** are the ones that don't work. I'm pretty sure
| its because I tried to use %username%. How do I fix this?
|
| Thank you in advance
|
| Andy
|
|
 
In order to expand variables from the registry you must use type
Reg_Expand_Sz

--
Regards,

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


:
| Hello Everyone,
|
| I have a fun one here that I can't figure out.
|
|
| I need to write script that edits keys in the registry. My regedit
command
| calls a file that has the following entries in it
|
| [HKEY_CURRENT_USER\Software\Hummingbird\Connectivity\8.00\Exceed]
| ***"EB"=REG_SZ:C:\Documents and Settings\"%username%"\Application
| Data\Hummingbird\Connectivity\8.00\Accessories\EB\***
| "FontDir"=REG_SZ:D:\Program
Files\Hummingbird\Connectivity\8.00\Exceed\Font\
| "HomeDir"=REG_SZ:D:\Program Files\Hummingbird\Connectivity\8.00\Exceed\
| "InfoDir"=REG_SZ:D:\Program
Files\Hummingbird\Connectivity\8.00\Exceed\Info\
| ***"UserDir"=REG_SZ:C:\Documents and Settings\%username%\Application
| Data\Hummingbird\Connectivity\8.00\Exceed\***
|
|
| The ones surrounded by *** are the ones that don't work. I'm pretty sure
| its because I tried to use %username%. How do I fix this?
|
| Thank you in advance
|
| Andy
|
|
 
This didnt work.
The registry entries are already there, they need to be updated.

Thanks,

Andy
 
This didnt work.
The registry entries are already there, they need to be updated.

Thanks,

Andy
 
What was it that didn't work?

--
Regards,

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


:
| This didnt work.
| The registry entries are already there, they need to be updated.
|
| Thanks,
|
| Andy
 
What was it that didn't work?

--
Regards,

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


:
| This didnt work.
| The registry entries are already there, they need to be updated.
|
| Thanks,
|
| Andy
 
If you export a type Reg_Expand_Sz then view the text you'll see that it is
a series of hex values. You might want to use RegWrite method of VBScript.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
 
If you export a type Reg_Expand_Sz then view the text you'll see that it is
a series of hex values. You might want to use RegWrite method of VBScript.

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
 
the type I'm trying to export to is a reg_sz. The issue is that we are
building a new Citrix Metaframe farm. The new farm uses different drive
letters than the old one did.

One piece of software has registry settings that are set to paths. The
settings that are coming over via the roming profile show the old drive
letters. I need to change the letters to reflect the new system. The paths
are profile depenent ex) c:\documents and settings\%username%\*****

I'm not familier with doing VB script. If that is what is needed, could you
point me to some good sources for a quick education?

Thanks,

All profiles for users that use this system are roaming.
 
the type I'm trying to export to is a reg_sz. The issue is that we are
building a new Citrix Metaframe farm. The new farm uses different drive
letters than the old one did.

One piece of software has registry settings that are set to paths. The
settings that are coming over via the roming profile show the old drive
letters. I need to change the letters to reflect the new system. The paths
are profile depenent ex) c:\documents and settings\%username%\*****

I'm not familier with doing VB script. If that is what is needed, could you
point me to some good sources for a quick education?

Thanks,

All profiles for users that use this system are roaming.
 
Your path included a variable %username% so in order to expand variables
from the registry you must use type
Reg_Expand_Sz not type Reg_Sz

Get the WSH 5.6 documentation download at
http://www.microsoft.com/downloads/...48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

--
Regards,

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


:
| the type I'm trying to export to is a reg_sz. The issue is that we are
| building a new Citrix Metaframe farm. The new farm uses different drive
| letters than the old one did.
|
| One piece of software has registry settings that are set to paths. The
| settings that are coming over via the roming profile show the old drive
| letters. I need to change the letters to reflect the new system. The
paths
| are profile depenent ex) c:\documents and settings\%username%\*****
|
| I'm not familier with doing VB script. If that is what is needed, could
you
| point me to some good sources for a quick education?
|
| Thanks,
|
| All profiles for users that use this system are roaming.
 
Your path included a variable %username% so in order to expand variables
from the registry you must use type
Reg_Expand_Sz not type Reg_Sz

Get the WSH 5.6 documentation download at
http://www.microsoft.com/downloads/...48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

--
Regards,

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


:
| the type I'm trying to export to is a reg_sz. The issue is that we are
| building a new Citrix Metaframe farm. The new farm uses different drive
| letters than the old one did.
|
| One piece of software has registry settings that are set to paths. The
| settings that are coming over via the roming profile show the old drive
| letters. I need to change the letters to reflect the new system. The
paths
| are profile depenent ex) c:\documents and settings\%username%\*****
|
| I'm not familier with doing VB script. If that is what is needed, could
you
| point me to some good sources for a quick education?
|
| Thanks,
|
| All profiles for users that use this system are roaming.
 
Andy said:
the type I'm trying to export to is a reg_sz. The issue is that we are
building a new Citrix Metaframe farm. The new farm uses different drive
letters than the old one did.

One piece of software has registry settings that are set to paths. The
settings that are coming over via the roming profile show the old drive
letters. I need to change the letters to reflect the new system. The paths
are profile depenent ex) c:\documents and settings\%username%\*****

I'm not familier with doing VB script. If that is what is needed, could you
point me to some good sources for a quick education?
Hi

For a list of some scripting resources and links to some Windows Script
Host (WSH) Web introductions, take a look here:

http://groups.google.com/[email protected]


Anyway, here is a shot on your "problem", using type "REG_EXPAND_SZ"
where necessary:

'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")
sRegKey = "HKCU\Software\Hummingbird\Connectivity\8.00\Exceed\"

' Program Files (PF) part
sPFPath = "D:\Program Files\Hummingbird\Connectivity\8.00\Exceed\"
oShell.RegWrite sRegKey & "FontDir", sPFPath & "Font\", "REG_SZ"
oShell.RegWrite sRegKey & "HomeDir", sPFPath, "REG_SZ"
oShell.RegWrite sRegKey & "InfoDir", sPFPath & "Info\", "REG_SZ"

' Application Data (AD) part as REG_EXPAND_SZ
sADPath = "%USERPROFILE%\Application Data\Hummingbird\Connectivity\8.00\"
oShell.RegWrite sRegKey & "EB", sADPath & "Accessories\EB\", "REG_EXPAND_SZ"
oShell.RegWrite sRegKey & "UserDir", sADPath & "Exceed\", "REG_EXPAND_SZ"
'--------------------8<----------------------



You can also do it with REG_SZ all the way, by expanding up the
environment variable before updating the registry. Exchange the
latter part of the script above with this in that case:

'--------------------8<----------------------
' Application Data (AD) part as REG_SZ
sADPath = oShell.ExpandEnvironmentStrings _
("%USERPROFILE%\Application Data\Hummingbird\Connectivity\8.00\")
oShell.RegWrite sRegKey & "EB", sADPath & "Accessories\EB\", "REG_SZ"
oShell.RegWrite sRegKey & "UserDir", sADPath & "Exceed\", "REG_SZ"
'--------------------8<----------------------
 
Andy said:
the type I'm trying to export to is a reg_sz. The issue is that we are
building a new Citrix Metaframe farm. The new farm uses different drive
letters than the old one did.

One piece of software has registry settings that are set to paths. The
settings that are coming over via the roming profile show the old drive
letters. I need to change the letters to reflect the new system. The paths
are profile depenent ex) c:\documents and settings\%username%\*****

I'm not familier with doing VB script. If that is what is needed, could you
point me to some good sources for a quick education?
Hi

For a list of some scripting resources and links to some Windows Script
Host (WSH) Web introductions, take a look here:

http://groups.google.com/[email protected]


Anyway, here is a shot on your "problem", using type "REG_EXPAND_SZ"
where necessary:

'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")
sRegKey = "HKCU\Software\Hummingbird\Connectivity\8.00\Exceed\"

' Program Files (PF) part
sPFPath = "D:\Program Files\Hummingbird\Connectivity\8.00\Exceed\"
oShell.RegWrite sRegKey & "FontDir", sPFPath & "Font\", "REG_SZ"
oShell.RegWrite sRegKey & "HomeDir", sPFPath, "REG_SZ"
oShell.RegWrite sRegKey & "InfoDir", sPFPath & "Info\", "REG_SZ"

' Application Data (AD) part as REG_EXPAND_SZ
sADPath = "%USERPROFILE%\Application Data\Hummingbird\Connectivity\8.00\"
oShell.RegWrite sRegKey & "EB", sADPath & "Accessories\EB\", "REG_EXPAND_SZ"
oShell.RegWrite sRegKey & "UserDir", sADPath & "Exceed\", "REG_EXPAND_SZ"
'--------------------8<----------------------



You can also do it with REG_SZ all the way, by expanding up the
environment variable before updating the registry. Exchange the
latter part of the script above with this in that case:

'--------------------8<----------------------
' Application Data (AD) part as REG_SZ
sADPath = oShell.ExpandEnvironmentStrings _
("%USERPROFILE%\Application Data\Hummingbird\Connectivity\8.00\")
oShell.RegWrite sRegKey & "EB", sADPath & "Accessories\EB\", "REG_SZ"
oShell.RegWrite sRegKey & "UserDir", sADPath & "Exceed\", "REG_SZ"
'--------------------8<----------------------
 
Back
Top