4

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

Rich Seller
  • 83,208
  • 23
  • 172
  • 177
Dave Moore
  • 4,397
  • 7
  • 25
  • 34

2 Answers2

3

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
  • 54,279
  • 5
  • 125
  • 144
  • 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 Nov 26 '09 at 16:58
1

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: Use 32 and 64bit Oracle Client in parallel on Windows 7 64-bit for e.g. .NET Apps

Relevant parts:

Open an elevated console and in %windir%\system32 create a soft link to the 64-bit oracle client installation, while in %windir%\SysWOW64 you make a soft link to the 32-bit installation.

Edit your PATH environment variable and add the following path to it: c:\windows\system32\11g. Please note that %WINDIR% will not be expanded in %PATH%.

Berin do CD
  • 789
  • 13
  • 23
flq
  • 22,247
  • 8
  • 55
  • 77