Finding a program in Program Files (x86)

Ripley

New member
Local time
8:42 PM
Messages
2
Location
Switzerland (a US person)
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\OpenOffice.org 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%\OpenOffice.org 3\program\soffice.exe

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

My Computer

Computer Manufacturer/Model Number
HP ProBook 6555b
OS
Windows 7 Pro 64 bit
Memory
4Gb
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 Computer

Computer Manufacturer/Model Number
HP Pavilion Elite 495UK
OS
Windows 7 Ultimate SP1 64-Bit
CPU
Intel Core i7 870 @ 2.93GHz
Motherboard
MSI 2A9C (CPU1)
Memory
8Gb Dual-Channel DDR3 @ 664MHz
Graphics Card(s)
nVidia GeForce GTX 460 1024MB dedicated RAM
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP2310i
Screen Resolution
1920 x 1080
Hard Drives
1x1954GB Hitachi HDS22020ALA 330 (RAID), 1x1954GB Hitachi External for backup and storage
PSU
460W
Case
HP Elite
Cooling
Air cooled
Keyboard
Logitech K750 solar-powered keyboard
Mouse
Logitech Wireless M180 mouse
Internet Speed
2Mb
Other Info
Pure Avanti Flow Internet Radio with iPod Dock, 64Gb iPod, HP USB Speakers, Sony MDR-V500 Headphones, Sony Vaio F-Series Laptop
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 Computer

Computer Manufacturer/Model Number
Scratch built
OS
Windows 7 x64 Ultimate
CPU
i7 960
Motherboard
Asus P6X58D
Memory
12 Gig Corsair Dominator
Graphics Card(s)
Nvidia 480
Sound Card
Maudio Delta 44 + breakout box
Monitor(s) Displays
Dell UltraSharp U2410 24in and Samsung 21 dual monitors
Screen Resolution
1920x1200 and 1280x1024
Hard Drives
Primary: Intel X-25M G2 160G SSD
Secondary: Segate baracuda 1.0 TB
HDs in AHCI mode.
PSU
Corasair TX850
Case
Cooler Master HAF
Cooling
Corsair H50
Keyboard
Logitech G15 + N52 game pad
Mouse
Logitech MX518
Internet Speed
15kbs down 4.5kbps up
Other Info
WEI 7.6
CPU & RAM 7.6
Graphics 7.9
Hard disk 7.7
fseal:
That's a pretty good suggestion.:geek: More direct than testing for flavor of Windows.

Thanks! (But I don't mark it solved yet)
 

My Computer

Computer Manufacturer/Model Number
HP ProBook 6555b
OS
Windows 7 Pro 64 bit
Memory
4Gb
Back
Top