J
Jerald Pratt
Guest
I've got a problem with a bat script where I'm test to see if an env
variable has been defined. On 32-bit OS this works fine but now I'm
seeing problem on 64-bit Windows (Vista). Here is the example line:
if DEFINED JAVA_HOME (
echo JAVA_HOME: %JAVA_HOME
)
On a 32-bit system, my JAVA_HOME is set to something like: C:\Program
Files\Java\jre1.5.0_06. But on a 64-bit system with the 32-bit java
installed, the same JAVA_HOME is set to: C:\Program Files
(x86)\Java\jre1.5.0_06.
The problem that I'm having is it seems that the extra "(x86)" define in
the variable is causing problem with the parenthesis in the "if"
statement. I would think that this should not matter since the "if
DEFINED" should only be checking to see if the variable is defined
(especially since I'm not using % to wrap the variable). When I run
this in a bat script I get a message complaining something about
"\Java\jre1.5.0_06" being an invalid statement (or something similar).
Has anyone else seen this? Its pretty easy to verify. Just create a
short bat script, define the variable and put the test statement that I
listed above.
Anyone know why this happens? Any ideas of how to work around this?
Jerald
variable has been defined. On 32-bit OS this works fine but now I'm
seeing problem on 64-bit Windows (Vista). Here is the example line:
if DEFINED JAVA_HOME (
echo JAVA_HOME: %JAVA_HOME
)
On a 32-bit system, my JAVA_HOME is set to something like: C:\Program
Files\Java\jre1.5.0_06. But on a 64-bit system with the 32-bit java
installed, the same JAVA_HOME is set to: C:\Program Files
(x86)\Java\jre1.5.0_06.
The problem that I'm having is it seems that the extra "(x86)" define in
the variable is causing problem with the parenthesis in the "if"
statement. I would think that this should not matter since the "if
DEFINED" should only be checking to see if the variable is defined
(especially since I'm not using % to wrap the variable). When I run
this in a bat script I get a message complaining something about
"\Java\jre1.5.0_06" being an invalid statement (or something similar).
Has anyone else seen this? Its pretty easy to verify. Just create a
short bat script, define the variable and put the test statement that I
listed above.
Anyone know why this happens? Any ideas of how to work around this?
Jerald