How to access nmake programfiles environment variable on x64 machines?

I am trying to get the path to an environment variable ProgramFilesthat should expand to C:\Program Files (x86)by machine x64and to C:\Program Filesby machine x86.

The problems are that in the nmake file, if I do this:

 all:
      echo $(PROGRAMFILES)

It will expand to C:\Program Filesevery time, and it is wrong.

Environmental Information from x64 machine:

ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files

:: this one is special, if will return different results based on current process x86/x64
ProgramFiles=C:\Program Files (x86) or C:\Program Files
PROCESSOR_ARCHITECTURE=x86 or x64

Now an updated question , how to get the location of x86 program files inside nmake, so this will work on both x86 and x64 machines ?

+3
source share
2 answers

, , 64- Windows 7, nmake 32-, 64- :

%%PROGRAMFILES(x86)%%

.

LC = %%PROGRAMFILES(x86)%%\Microsoft SDKs\Windows\v7.0A\bin\lc.exe
+2

x64, , %ProgramFiles% C:\Program Files - 64- . , x86-, %ProgramFiles(x86)%.

, , , ​​ PROCESSOR_ARCHITECTURE (, , ​​ AMD64). %ProgramFiles(x86)%, , %ProgramFiles%.

32- cmd.exe make. C:\Windows\SysWOW64.

+1

Source: https://habr.com/ru/post/1756417/


All Articles