I want to write a simple batch file where i want to setup a environment variable based on the machine architecture. It is as below:
set ARCH=%PROCESSOR_ARCHITECTURE%
echo %ARCH%
if %ARCH%==x86 (
set JAVA_ROOT=C:\Progra~1\Java\j2re1.4.2_13
) else (
set JAVA_ROOT=C:\Progra~2\Java\j2re1.4.2_13
)
echo JAVA_ROOT is %JAVA_ROOT%
On 64-bit machine where the architecture is 'AMD64' the JAVA_ROOT will be displayed as 'C:\Progra~2\Java\j2re1.4.2_13' at the echo statement. But when i run an application that uses this file, the first value of JAVA_ROOT would be picked up 'C:\Progra~1\Java\j2re1.4.2_13'. I don't have any idea why it goes in the 'if' part even though i am running this on 64-bit Windows7. When i echoed the