Tuesday, 6 August 2019

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


I installed both 32bit and 64bit version of OpenSSL libs on Vista x64. The 32bit version was installed in c:\Program Files (x86)\OpenSSL and the 64bit version was installed in c:\Program Files\OpenSSL. Then I added the entry %ProgramFiles%\OpenSSL to the PATH environment variable. %ProgramFiles%\OpenSSL is expanded to c:\Program Files (x86)\OpenSSL for 32bit programs and it's expanded to c:\Program Files\OpenSSL for 64bit programs. The idea is to have 32bit programs use 32bit version of OpenSSL libs and 64bit programs use 64bit version. I wanted to check if this works by running 32bit cmd.exe and issuing where ssleay32.dll and then by running 64bit cmd.exe and issuing the same. However in both cases I get the error INFO: Could not find files for the given pattern(s).
What's wrong?


This is a follow up to Different PATH environment variable for 32bit and 64bit Windows - is it possible?



Answer



Put the 32bit .DLLs into the \Windows\SysWOW64 directory and the 64bit DLLs into the \Windows\system32 directory.


EDIT:


Maybe this helps:



This is just an intelligent guess, but following some investigation I believe I've found the problem:


If the definition of an environment variable var1 contains another environment variable var2 and the name of var1 is alphabetically less than the name of var2 (i.e. strcmp(var1, var2) < 0), then var2 won't get expanded. This seems to be because when Windows first sets up the environment variables, they are created in alphabetical order, so var2 does not exist until after var1 has already been created (and so the expansion can't be done).


I believe this is a limitation in Windows. Really some sort of dependency check between the variables should be carried out so that they are created in the correct order. Fortunately, there is a workaround.


1) Enable 'delayed variable expansion' in the registry (see http://batcheero.blogspot.com/2007/06/how-to-enabledelayedexpansion.html)


2) Change the '%' signs around var2 to '!', e.g. "%var2%" becomes "!var2!"


I've done some limited testing on Windows 7 and this appears to fix the problem.



It's from here: http://social.answers.microsoft.com/Forums/en-US/vistainstall/thread/48b23109-9fbc-47c5-a5d1-465773f94704


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...