locked
Program Files Vs. Program Files (x86)

    Question

  • I have developed a simple set of utilities with VB.NET that runs on both 32-bit and 64-bit clients.  I am deploying the software via a VBScript that copies creates a program folder under the program files heirarchy and copies the EXE files (three of them) to the newly created folder, and then at run time, creates a log file of activity, saving the log to this folder as well.

    The problem is twofold:

    A)  I am using the %ProgramFiles% environment variable in my VBScript to determine where the Program Files directory is located.  This works great, but on x64 bit clients it copies the EXE files to "C:\ProgramFiles (x86)\My Folder", plus my System Center Configuration Manager advertisements run the EXE files from the (x86) Program Files folder too.

    B)  At runtime, when the log is created, my applications attempt to write to the log file in the expected location "C:\Program Files\My Folder" but since that folder was never created, the application generates an error, and cannot output a log file.

    The simple fix is to create a check in my application to see if the folder exists first, then create it if it does not, but doing this will separate my program EXE files from my log file.  However, I move the EXE files, my SCCM advertisement fails because it can't find the EXEs.  I know there is also an environment variable for ProgramFiles(x86), but is there an equivlent to force it to ProgramFiles(x64) so SCCM will be able to launch the EXE from the expected location?

    My other alternative is to force the application to a 32-bit platform.  This is an easy fix, but I'd like to solve the problem, not abandon the 64-bit platform.

     

    Tuesday, June 01, 2010 6:26 PM

Answers

All replies