OK, here's what I've just tried (Windows XP SP2, SQL Server 2008 SP1 CU4).
- In Computer Properties, add a system environment variable called Test, value Test
- xp_cmdshell 'set' Result - new variable did not appear in result set
- Restart SQL Server
- xp_cmdshell 'set' Result - new variable appeared in result set
- In Computer Properties, change value of Test variable to Test1
- xp_cmdshell 'set' Result - variable still appeared with old value (Test)
- Restart SQL Server
- xp_cmdshell 'set' Result - variable appeared with new value (Test1)
- In Computer Properties, delete Test variable
- xp_cmdshell 'set' Result - variable still appears, with value Test1
- Restart SQL Server
- xp_cmdshell 'set' Result - Test variable no longer appears
Like Brandie, I avoid environment variables and use configuration files where possible.
John