views:

289

answers:

2

I am moving to a 64 bit Windows workstation, and will be developing both 32 and 64 bit applications. I will need to maintain different PATH environment variables when running a 32 vs. 64 bit version of my application.

What is the best way to do this? It seems like it should be possible with all of the registry redirection that goes on.

Thanks, Dave

+2  A: 

This isn't directly possible since system-wide environment variables are stored in HKLM\System\CurrentControlSet\Control\Session Manager\Environment, and there is no WOW64 redirection of the SYSTEM hive.

If your program installs under Program Files, you could add your path based off of %ProgramFiles% to the PATH environment variable - %ProgramFiles% expands to the 32-bit program files when running under WOW64.

Michael
Unfortunately it seems that %PROGRAMFILES% does not expand in %PATH%, maybe because it's defined later in the process?What else could one try?
flq
+1  A: 

I found a "trick" which is based on the redirection magic that Windows does with its system32/SysWOW64 folder. It works quite well for my 32 and 64-bit Oracle Clients. I have documented the procedure on my website: http://realfiction.net/?q=node/187

flq