3

Might it make more sense to put 64-bit applications into "Program Files (x64)" and leave 32-bit applications to run in "Program Files"?

I have a batch file that need to run a Flex compiler. In x64, that program is in "Program Files (x86)". On Windows Vista 32-bit, it's in "Program Files" - environment variables? Check it:

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

What do I do?


set mxmlc="%ProgramFiles(x86)%\Adobe\Flex Builder 3\sdks\3.1.0\bin\mxmlc.exe"
if NOT EXIST %mxmlc% set mxmlc="%ProgramFiles%\Adobe\Flex Builder 3\sdks\3.1.0\bin\mxmlc.exe"

tnx

casperOne
  • 73,706
  • 19
  • 184
  • 253
Scott Evernden
  • 39,136
  • 15
  • 78
  • 84
  • I call flamebait. Any objections to closing this topic? – Jason Baker Nov 16 '08 at 02:30
  • 3
    maybe if i got one sensible answer before you just decide to rip the thing down - ?? – Scott Evernden Nov 16 '08 at 02:37
  • 1
    32-bit vs. 64-bit architecture issues are absolutely programming related. – Adam Lassek Nov 16 '08 at 02:45
  • @Scott - I tried to think of a way to edit this to be more programming related and not as flame provoking, but couldn't. If you or somebody can think of some way to change it, I wouldn't have any problem with reopening it. – Jason Baker Nov 16 '08 at 02:46
  • Okay. lemme try an edit cause i am truly facing a problem I need answer for – Scott Evernden Nov 16 '08 at 02:49
  • Much better. I was just dreading getting a snooty Mac or Linux nerd reading this topic (and I have a right to say that as a user of both of those operating systems). – Jason Baker Nov 16 '08 at 02:55
  • @JasonBaker Your fears have come true! – Constantino Tsarouhas Aug 06 '12 at 17:27
  • This is fine with me - I just wish they had done the same with System32, and called the 32 bit version "System32(x86)". But no - they called it "SysWOW64" - just to be sure nobody understands where the 32 bit system stuff are located... – awe Aug 27 '12 at 13:51

7 Answers7

7

That's nothing. Guess what \Windows\System32 contains? That's right, 64-bit DLL files. So where did they decide to put 32-bit legacy DLL files? \Windows\SysWOW64 of course.

The problem is, while there are built-in facilities for Windows applications to discover the location of system directories, many applications don't use them. And since Microsoft, above all else, is a slave to backwards compatibility we get stupid stuff like this.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Adam Lassek
  • 35,156
  • 14
  • 91
  • 107
  • Just love those Windows consistencies. Also, in 64-bit Task Manager, 32-bit processes are suffixed with "*32", instead of "x86" – Gordon Bell Nov 16 '08 at 06:54
  • 1
    @ajryan Sure it was, to his original question. Many software vendors hardcode things they shouldn't, and MS is pathologically averse to breaking changes. – Adam Lassek Nov 17 '08 at 18:10
7

To make it portable:

SET ExecPath=%ProgramFiles(x86)%
IF "%ExecPath%"=="" SET ExecPath=%ProgramFiles%
Aidan Ryan
  • 11,389
  • 13
  • 54
  • 86
  • That sets an environment variable called "ExecPath ", including the space. You should remove the spaces around the equals sign. The value of the environment variable will also include double-quotes, which breaks your comparison. – bk1e Feb 10 '09 at 16:18
  • Does this work for anyone? On a 32 bit 2k3 VM, the environment variable ExecPath has a value of %ProgramFiles(x86)%. Not "C:\Program Files (x86)", but literally %ProgramFiles(x86)% with the percent signs. – Josh Clark May 25 '11 at 21:38
  • I just made a couple of corrections - spacing around operators and extra quotes fixed. – Aidan Ryan May 26 '11 at 01:59
2

x86 is commonly assumed to be 32-bit unless you specify x86-64. Why do they need their own program files directories anyway?

Alex Gaynor
  • 14,353
  • 9
  • 63
  • 113
1

Uh... I think x86 refers to the Intel processor architecture, e.g. 8086, 80286, 80386, 80486, and 80586.

80386 had the first 32-bit instruction set, see x86 (Wikipedia).

EDIT: Ah, the question was clarified.

See Stack Overflow question C# - How to get Program Files (x86) on Vista x64.

Community
  • 1
  • 1
Steven A. Lowe
  • 60,273
  • 18
  • 132
  • 202
1

EDIT: I have a batch file that need to run FLEX compiler. in X64 that program is in "Program Files (x86)" on Vista 32 bit it's in "Program Files" .. environment variables ? .. check it:

Use the %ProgramFiles% environment variable and skip all this hassle.

Ana Betts
  • 73,868
  • 16
  • 141
  • 209
1

a.) Just because the default installation location changes doesn't mean you HAVE to install stuff there. A simple registry change will make your new installs go anywhere you want. Mine all go to a separate drive, into folders of my choosing. If an application can't even keep track of its installation path through the registry then it's probably not worth installing in the first place.

b.) I'm assuming they put 32-bit applications into an x86 folder because it's not a 32 bit OS, that is, old stuff goes here. You wouldn't buy a new house and let your dog sleep in it while you sleep in his old dog house, right? If 64 bit is a step forward then why would you put the legacy software in what will continue to be the standard installation folder?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • a) the question if you read it has to do with developing on different pcs that have tools installed in their default locations, which is a *different* location depending on the OS b) what would make sense if you're evolving a product is to NOT BREAK the old but create a NEW PLACE for the new. – Scott Evernden Mar 22 '09 at 04:29
-4

Because Microsoft loves making things more complex for people. Rather than simplifying the transition to 64-bit, they made it divided and difficult.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
CVertex
  • 17,997
  • 28
  • 94
  • 124