Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Finding a program in Program Files (x86)

31 Aug 2011   #1

Windows 7 Pro 64 bit
Finding a program in Program Files (x86)

Running Windows 7 Pro, 64bit.

We have a package of scripts and programs that comprise a custom application for OpenOffice 3.2 (do not want to upgrade OO at this point). We must support our package on Win XP, Vista and 7.

A bunch of our scripts start up OpenOffice by running the command:
C:\Program Files\ 3\program\soffice.exe (with arguments).

Works fine on XP. Fails on Win7 because the OO program installs itself into Program Files (x86). Even if I change properties of the installer file, in the Compatibility tab, to Win XP SP3, AND tell the installer to put it in C:\Program Files, Windows 7 still installs it into Program Files (x86).

We would LIKE to have the same script work on both flavors of Windows. I know we can modify our scripts to branch on which Windows, and choose two different paths to soffice.exe, but that's messy.

I can't solve it by creating a shortcut in Program Files, to the program in Program Files (x86); that's not allowed.

Is there some solution in Windows 7 to find the program no matter which place it lives? Like, a semi-intelligent environment variable for ProgramFiles that looks in one place, then the other? Ie.:
"C:\%ProgramFiles%\ 3\program\soffice.exe

Maybe I'm missing some easy solution, but so far I don't see it.

My System SpecsSystem Spec

31 Aug 2011   #2

Windows 7 Ultimate SP1 64-Bit

The reason the programs plonk themselves in the Program Files (x86) must be because they are 32-bit applications.

By default, Windows 7 64-Bit installs 32-bit applications in the Program Files (x86) folder, whilst 64-bit applications reside in the Program Files folder.
My System SpecsSystem Spec
31 Aug 2011   #3

Windows 7 x64 Ultimate

Unfortuantely the environment variable for that folder is called "%ProgramFiles(x86)%" to get to the 32 bit programs folder. And apparently only even exists on the 64 bit version of W7.

You may have to test for the existance of "%ProgramFiles(x86)%" and use if if it's defined, else use ""%ProgramFiles%"
My System SpecsSystem Spec

31 Aug 2011   #4

Windows 7 Pro 64 bit

That's a pretty good suggestion. More direct than testing for flavor of Windows.

Thanks! (But I don't mark it solved yet)
My System SpecsSystem Spec

 Finding a program in Program Files (x86)

Thread Tools

Similar help and support threads
Thread Forum
Point new program installations to C:\Program Files NOT (x86)
I have always kept my programme installation directories in C:\Program Files and would prefer to keep it that way. So many programmes these days default to C:\Program Files (x86). It is a pain to keep editing the location required when setting up a new machine. Is there any way to persuade new...
General Discussion
Will installing a 64-bit program in Program Files (x86) cripple it?
Hi, I have a question about Windows 7 Program Files folders. There is a lot of discussion on why the distinct folders are necessary, but I remain unclear about this problem. Let's say I have a portable 64-bit program whose binaries and dll's arrive in an archive like a .zip package. Will...
Program installed in Program Files requires elevation?
I have a program that wanted to install in a document folder :mad: I have installed it in Program Files, but it requires elevation or it produces errors when running. I know I can tick the Run As ... box in the shortcut, but is there a better way, such as taking ownership of the install folder?
System Security
Program refusing to install in standard program files folder
I have an Advent (PC World brand) Laptop that comes with its own custom On-Screen Display software. The software is made for 32 bit Windows with no 64 bit version available as far as I'm aware. I have upgraded to 64 bit Windows recently and everything seems to work great except the OSD. ...
Program Files (x86) & Program Files Installed On Another Drive
Hi have have a new PC running Win7 Home Premium 64bit. I have 2 drives: 1 x 120GB SSD (running the OS) (C Drive) 1 x 1TB HDD (D Drive) The SSD is running the OS and a couple of main programs which i use quite often (ie. Office 2010, Antivirus, etc). The HDD i want to use to install and...
General Discussion
Program Files or Program Files (x86)-Where to place downloaded program
My computers are both running Win 7 64-bit. I am thoroughly confused when it comes to placing programs that I download into their proper folders: That is, program files (x86) vs program files. I have read stuff on this, but still confused. for the most part, even when a dl'd program suggests...

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 07:23.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App