Hi Ian, If all you want to do is start a process in code you can use the Environment.ExpandEnvironmentVariables(..) method to do it for you:
Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%\\TextPad 5\\TextPad.exe") Returns C:\Program Files (x86)\TextPad 5\TextPad.exe on my machine. If you reference an environment variable that doesn't exist then it just doesn't get expanded. Regards, Michael M. Minutillo Indiscriminate Information Sponge http://codermike.com On Wed, Feb 8, 2012 at 4:36 PM, Ian Thomas <il.tho...@iinet.net.au> wrote: > ** ** ** > > Is there an environment variable ProgramFilesx86 to locate C:\Program > Files (x86) on a 64-bit Windows? **** > > Although some of the MSDN documentation specifically mentions an > environment variable ProgramFilesX96 member in the > Environment.SpecialFolder Enumeration ( > http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx > ), > it isn’t shown by intellisense - Environment.GetFolderPath( > System.Environment.SpecialFolder.ProgramFilesx86) and doesn’t compile. *** > * > > Further, while I can use the Windows Run to expand %ProgramFiles(x86)% - * > *** > > "%ProgramFiles(x86)%\TextPad 5\TextPad.exe" -m -r "C:\Users\(some > location)\MyApp.log"**** > > will work as desired, for example - if I want to start a process in code > it doesn’t expand the environment variable – **** > > MyProcess.StartInfo.Filename = “%ProgramFiles(x86)%\TextPad 5\TextPad.exe” > **** > > (fails) **** > > I am using 3.5 Framework, and need to remain with this. Maybe in 4.0 the > doco is correct and this works (have not tried) – or am I missing a few > very obvious things? **** > ------------------------------ > > **Ian Thomas** > Victoria Park, ********Western Australia************ >