Yes it is absolutely possible. Simply write a three .bat files. The first one should look like this:
@echo off
if "%1" == "" goto x86
if not "%2" == "" goto usage
if /i %1 == x86 goto x86
if /i %1 == ia64 goto ia64
goto usage
:x86
if not exist "%~dp0bin\x86.bat" goto missing
call "%~dp0bin\x86.bat"
goto :eof
:ia64
if not exist "%~dp0bin\ia64.bat" goto missing
call "%~dp0bin\ia64.bat"
goto :eof
:usage
echo Error in script usage. The correct usage is:
echo %0 [option]
echo where [option] is: x86 ^| ia64
echo:
echo For example:
echo %0 x86
goto :eof
:missing
echo The specified configuration type is missing. The tools for the
echo configuration might not be installed.
goto :eof
The second and the third .bat file are basically the same, except they differ in their name. The first will be called x86.bat the second ia64.bat and they are placed in a folder called bin which is above the the first bat file. You will have this:
PATH\first.bat
PATH\bin\x86.bat
PATH\bin\ia64.bat
The content of the second and third .bat file should look like this:
@set PATH=THE PATH YOU WANT
You could create a link to first .bat file which will have the following settings:
Target: %comspec% /k "PATH\first.bat" OPTION | Where OPTION is x86 or ia64
Start in: PATH | Where PATH is the PATH to your first.bat
The script is the simplified script Microsoft uses to start the right command line for their Visual Studio environment. You could simply expand this scripts to N environments. By adding more .bat files for different environments and by editing the first.bat with more options and goto statements. I hope it is self explaining.
And i hope Microsoft does not sue me for using their script.
EDIT:
Ah i think i misunderstood you a bit. For the 32bit cmd line the link should be created as:
Target: %windir%\SysWoW64\cmd.exe "PATH\first.bat" x86
EDIT2:
Try something like:
if "%ProgramFiles%" == "%ProgramFiles(x86)%" goto x64_PATH
if "%ProgramFiles%" == "%ProgramW6432%" goto x86_PATH
:x64_PATH
@set PATH=YOUR 64 bit PATH
SOME_PATH\your64BitApp.exe
goto :eof
:x86_PATH
@set PATH=YOUR 32bit PATH
SOME_PATH\your32BitApp.exe
goto :eof
1Well I have some trouble getting it to work.
echo %programfiles%
shows different path depending on the type of cmd.exe it's run from butwhere ssleay32.dll
in both types of cmd.exe (32bit and 64bit) can't find this dll and displaysINFO: Could not find files for the given pattern(s).
Any ideas? – Piotr Dobrogost – 2011-02-19T10:13:33.607This might help: Altough this might help: http://stackoverflow.com/questions/906310/installing-registering-win32-openssl-libraries-distributed-with-my-app
– Darokthar – 2011-02-19T14:57:32.7171if one of the dlls is a 32-bit one, on 64-bit machine it should go into C:\windows\syswow64 folder – romka – 2011-02-20T13:21:59.057
This does not work for me. When I include %ProgramFiles% in the PATH variable definition, it does not get expanded at all, so my exe doesn't find its dlls. – Carlos A. Ibarra – 2014-05-27T23:03:32.167