RE: Setting DOS environment variables

2011-10-26 Thread David Kean
It's a collection, you add to it: startInfo.EnvironmentVariables.Add("TEMP", "C:\Temp") From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Ian Thomas Sent: Wednesday, October 26, 2011 2:32 AM To: 'ozDotNet' Subject: RE: Set

RE: Setting DOS environment variables

2011-10-26 Thread Ian Thomas
Get, no Set _ Ian Thomas Victoria Park, Western Australia _ From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of David Kean Sent: Wednesday, October 26, 2011 8:24 AM To: ozDotNet Subject: RE: Setting DOS environment variables Have you

RE: Setting DOS environment variables

2011-10-25 Thread David Kean
PM To: 'ozDotNet' Subject: Setting DOS environment variables Several years ago I tried to find a way of setting (creating) DOS environment variables in code and then using the values in batch files. I remember I failed because the variables only existed for the duration of the proces

Re: Setting DOS environment variables

2011-10-25 Thread mike smith
It's only set up at run-time initialisation as far as I know. If you want something better use shared memory and some sync objects to control who is able to write to it, and signal to other subscribers when it changes. Or something like that. On Wed, Oct 26, 2011 at 11:04 AM, Mark Hurd wrote:

Re: Setting DOS environment variables

2011-10-25 Thread Mark Hurd
Environment variables *should* be inherited from the creating process to the child process, though I believe the Win32API makes that optional. Once the child process is created it has its own environment variables that can be adjusted internally (and SET is a built-in from CMD for that reason), but

RE: Setting DOS environment variables

2011-10-25 Thread Greg Keogh
Chaps, I think I'll abandon this experiment again. I'm not happy with the way the new function stuffs your values into the HKCU or HKLM hives and the values are not instantly available to the caller. I just wanted to knock up a bit of code which did the same thing as the SET command, but it doesn't

RE: Setting DOS environment variables

2011-10-22 Thread Fredericks, Chris
otnet-boun...@ozdotnet.com] On Behalf Of Greg Keogh Sent: Sunday, 23 October 2011 2:46 PM To: 'ozDotNet' Subject: RE: Setting DOS environment variables Could you use setx? I think its an old sysinternals tool. I hadn't noticed that tool before. But sadly: Setx writes variab

RE: Setting DOS environment variables

2011-10-22 Thread Greg Keogh
Could you use setx? I think its an old sysinternals tool. I hadn't noticed that tool before. But sadly: Setx writes variables to the master environment in the registry. Variables set with setx variables are available in future command windows only, not in the current command window. Greg

Re: Setting DOS environment variables

2011-10-22 Thread Mark Ryall
Could you use setx? I think its an old sysinternals tool. On Oct 23, 2011 12:49 PM, "Greg Keogh" wrote: > Several years ago I tried to find a way of setting (creating) DOS > environment variables in code and then using the values in batch files. I > remember I failed because the variables only e

Re: Setting DOS environment variables

2011-10-22 Thread Preet Sangha
Does reg query work? - set a user env var: (your app etc) - get it with reg query and put into a variable locally for processing : *for /f "tokens=3" %f in ('reg query HKEY_CURRENT_USER\Environment /v someVar') do @set someVar=%f* I set the variable after the command prompt has been

Setting DOS environment variables

2011-10-22 Thread Greg Keogh
Several years ago I tried to find a way of setting (creating) DOS environment variables in code and then using the values in batch files. I remember I failed because the variables only existed for the duration of the process. I had a fresh look at this problem today and was thrilled to see a 3rd ar