Thank you for the answers guys. I've experienced issues in the past when using REG_SZ for environment variables, and hence stick with using REG_EXPAND_SZ. The original problem I was trying to solve was where a user used an application which tried to open an an ini file in "c:\documents & settings\administrator\windows\myinifile.ini" I loaded the default users ntuser.dat file, searched for instances of the admin account name, but found nothing. However, the search did find an entry in the HKEY_USERS\.DEFAULT with the incorrect path to the ini file in the administrators profile. There were also entries in explorer shell folders with the administrators profile path. This is what lead me to think about running a test using the %userprofile% environment variable in the reg value. If I am correct the (default) value created for a registry key is always REG_SZ. So if an application install creates a registry key and uses the default value, am I correct in thinking that it will always be REG_SZ and can not be changed? eg. An installer creates the "HKLM\software\myapp\config" key and then, using the default value, assigns it a value of "c:\documents and settings\administrator\windows\myinifile.ini" In this scenario, I would have thought it would be better practice for the value to use an environment variable, %userprofile%, but since the default value was used by the installer which is of type (REG_SZ), the use of environment variables is not recommended. So that leads me to ask, which would be the preferred way to change this in the registry so that the application still finds the correct key/value, but changing the value to use an environment variable? (If all installers created REG_EXPAND_SZ keys where needed and used environment variables, I wouldn't be asking this question :-) Luckily we use Powerfuse, so I was fairly trivial to first apply a fix, and then try and gain a better understanding of the OS afterwards! Thanks Joe >>> joe.shonk@xxxxxxxxx 23/03/2006 16:24 >>> REG_EXPAND_SZ is required if you wish to have environment variables expanded when a program or script reads the Data for that Value. Also, if your looking to configure the default profile, HKCU\.Default is not the key you need to modify. To modify the Default User, you need to load the ntuser.dat hive (typically, c:\documents and settings\default user\) and modify that. HKCU\.Default is the default profile used on the console when no one is logged in. Joe >>> jeremy.saunders@xxxxxxxxxxx 23/03/2006 14:02 >>> Hi Joe, If REG_SZ works without giving you problems, then it should be okay for you. However, I always use REG_EXPAND_SZ simply because Microsoft say you should. With REG_EXPAND_SZ string values, you can safely use environment variables for paths that are stored in the registry. This ensures that the any environment variable used is correctly expanded. Leaving it as a REG_SZ value can provide inconsistent results depending on how well the application accessing the keys has been written. As a note you shouldn't be directly modifying the anything under the "Shell Folders" key, just the "User Shell Folders" key. And whilst you can change the REG type, you can delete the REG_SZ and recreate it as a REG_EXPAND_SZ. Whilst that's not a difinitive answer, it may give you a guide. Kind regards, Jeremy Saunders Senior Technical Specialist Integrated Technology Services & Cerulean IBM Australia Level 2, 1060 Hay Street West Perth WA 6005 Visit us at http://www.ibm.com/services/au/its P: +61 8 9261 8412 F: +61 8 9261 8486 M: TBA E-mail: jeremy.saunders@xxxxxxxxxxx "Joe Grainger" <jag@xxxxxxxxxxxx o.uk> To Sent by: <thin@xxxxxxxxxxxxx> thin-bounce@freel cc ists.org Subject [THIN] Explorer shell folders in 23/03/2006 07:42 hkey_users\.default\ (reg_sz keys PM & environment variables) Please respond to thin Hi all, I've researched this one briefly, using google, tweaking keywords, and limiting search results by domain. (e.g. using site:microsoft.com) Viewing the contents of the registry, the default key value is always REG_SZ, and can't be changed. On Windows 2003 Server, because the default value is REG_SZ, can you modify a default value to include an environment variable? E.g Replacing "c:\documents and settings\administrator\recent" with "%userprofile%\recent" I have found Microsoft Knowledge Base articles which do state that to use environment variables, you have to use the REG_EXPAND_SZ value type. However I can't find a definitive answer to my question before I run any tests. Thanks! Joe Hazlewoods LLP - Chartered Accountants and Business Advisers Offices in Cheltenham Tel 01242 237661, Gloucester Tel 01452 634800 and Staverton Tel 01242 680000. Members: Harvey Grove FCA FCCA Andrew Brookes FCA CF Jon Cartwright FCCA ATII TEP Nick Dee ACA Tony Flambard FCCA David Granger FCA FCCA Jonathan Harvie FCA David Main FCCA Christopher Mourton FCCA David Pierce FCA FCCA Adrian Randle FCA FCCA TEP Graham Rew FCA Philip Swan FCA ATII Norman Webber FCCA CF David Williams FCA Website www.hazlewoods.co.uk. Registered by the Institute of Chartered Accountants in England and Wales to carry out company audit work. Authorised and Regulated by the Financial Services Authority. Registered in England. Partnership No: OC311817 ************************************************************************ DISCLAIMER: The contents of this Email and attachments are confidential to the ordinary user(s) of the Email address(es) to which it was sent and may be legally privileged. Hazlewoods LLP accepts no responsibility for the content of this Email, or the actions taken on the basis of the information provided, unless that information is subsequently agreed in writing. ************************************************************************+rzRJ?mn+o(+U*'^o?%y! 0~+-Xa ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ Hazlewoods LLP - Chartered Accountants and Business Advisers Offices in Cheltenham Tel 01242 237661, Gloucester Tel 01452 634800 and Staverton Tel 01242 680000. Members: Harvey Grove FCA FCCA Andrew Brookes FCA CF Jon Cartwright FCCA ATII TEP Nick Dee ACA Tony Flambard FCCA David Granger FCA FCCA Jonathan Harvie FCA David Main FCCA Christopher Mourton FCCA David Pierce FCA FCCA Adrian Randle FCA FCCA TEP Graham Rew FCA Philip Swan FCA ATII Norman Webber FCCA CF David Williams FCA Website www.hazlewoods.co.uk. Registered by the Institute of Chartered Accountants in England and Wales to carry out company audit work. Authorised and Regulated by the Financial Services Authority. Registered in England. Partnership No: OC311817 ************************************************************************ DISCLAIMER: The contents of this Email and attachments are confidential to the ordinary user(s) of the Email address(es) to which it was sent and may be legally privileged. Hazlewoods LLP accepts no responsibility for the content of this Email, or the actions taken on the basis of the information provided, unless that information is subsequently agreed in writing. ************************************************************************