When 32 bit programs install on a 64 bit Windows they are dumps %ProgramFiles% into %ProgramFiles(x86)% and the default command line in 64 bit Windows is the one that is 64 bit which directs %ProgramFiles% to %ProgramFiles%. So if you want to access a 32 bit program you have to use %ProgramFiles(x86)%. This can really complicate matters if you need to access the same program on both 32 bit and 64 bit Windows. So what can you do? Try this:
@Echo Off
Set Programs=%ProgramFiles%
If "%PROCESSOR_ARCHITECTURE%" == "x86" Set Programs=%ProgramFiles%
If "%PROCESSOR_ARCHITECTURE%" == "AMD64" Set Programs=%ProgramFiles(x86)%
If "%PROCESSOR_ARCHITECTURE%" == "IA64" Set Programs=%ProgramFiles(x86)%
CD /d %Programs%
This method is extensible so that you can add any additional operating system processor types as they become available and it allows you to select the correct path for each one.
One little fun note is in the dummy CD call I'm using /d which changes the current drive as well as changing the directory for the drive. Fun!
No comments:
Post a Comment