Windows – Different PATH environment variable for 32bit and 64bit Windows – is it possible

32-bit64-bitenvironment-variablespathwindows

Is it possible to have whole or part of PATH environment variable specific to the type of running process's image (32bit/64bit)?
When I run some app from within 64bit cmd.exe I would like to have it pick the 64bit version of OpenSSL library whereas when I run some app from within 32bit cmd.exe I would like to have it pick the 32bit version of OpenSSL library.

FOLLOW UP
where.exe does not find OpenSSL libs when %ProgramFiles% variable is used in the PATH environment variable

Best Answer

Make %ProgramFiles% to %ProgramFiles(x86)% env variable switching to work for you:

Place folders with x32 and x64 versions of OpenSSL library into appropriate %programfiles% and %ProgramFiles(x86)% directories and in the PATH environment variable, use a reference to these folders via the %programfiles% variable.

This way, when you are running in x32-bit environment, your PATH entry %programfiles%/OpenSSL/ will automatically get resolved to %ProgramFiles(x86)%/OpenSSL/ on a disk.