Program Path with ENVIRON

ta5ta5 Member Posts: 1,164
Hi
I have a question to ENVIRON command

If I use environ('ProgramFiles'), I get 'c:\program files (x86)' on a german Windows7 64 Bit.
Digging a bit deeper, on a command line I get 2 values: 'c\program files' AND 'c:\program files (x86)'.

This behaviour seems by desing, because in fact there exist 2 environ variables ProgramFiles and ProgramFiles(x86) beginning with the same letters.

Is there a way to return only one value, means using no "Wildcards"?

Thanks for any ideas.
Thomas

Answers

  • vaprogvaprog Member Posts: 1,141
    There are no wildcards involved here. Instead, the environment is differently when seen from a program running under WoW64 to when seen from a native x64 program.
  • ta5ta5 Member Posts: 1,164
    Do you man, if a 64 bit NAV calls the ENVIRON('ProgramFiles') function, the return value is not the same as when a 32 bit NAV would do the same?
    But anyway, there are 2 different Environment variables as written in the init post.... :?
  • vaprogvaprog Member Posts: 1,141
    Yes, exactly.

    In a 32-bit cmd-shell you usually have
    ProgramFiles=C:\Program Files (x86)
    ProgramFiles(x86)=C:\Program Files (x86)
    ProgramW6432=C:\Program Files

    in a 64-bit cmd-shell you usually have
    ProgramFiles=C:\Program Files
    ProgramFiles(x86)=C:\Program Files (x86)
    ProgramW6432=C:\Program Files

    (That's for Windows 7 x64)
  • ta5ta5 Member Posts: 1,164
    Thanks, this is solved now! I was not Aware about different shells on the same machine!
    Regards
    Thomas
Sign In or Register to comment.