Right now I’m using two Batch files, well call them variables.cmd and main.cmd for this example. The variable.cmd file is to be used for externalizing a set of variables that might be used with multiple other batch files.
Now every variable has no problem being accessed in the main.cmd file except CLASSPATH. When echo is called within variables.cmd the CLASSPATH is correctly created, but when echoed in the main.cmd file I get the following result:
!CLASSPATH!;C:\ipp\deploy\lib\app\momex-webservice-client.jar;C:\ipp\deploy\resources
Any ideas on whats happening and how it can be resolved?
This is the main.cmd file:
@echo off
call variables.cmd
echo %JAVA_HOME%
echo %DEPLOY%
echo %DEBUG%
echo %DEBUG_PORT%
echo %JAVA_OPTIONS%
echo %CLASSPATH%
This is the variables.cmd file:
@echo off
setlocal EnableDelayedExpansion
set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_30"
set DEPLOY=C:\ipp\deploy
set DEBUG=false
set DEBUG_PORT=15000
set JAVA_OPTIONS="
set JAVA_OPTIONS=%JAVA_OPTIONS% -Djava.endorsed.dirs=%DEPLOY%\lib\endorsed
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump="true"
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dconfiguration.properties=%DEPLOY%\resources\vendor.configuration.properties
if "%DEBUG%"=="true" (
set JAVA_OPTIONS=%JAVA_OPTIONS% -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=15000,suspend=n,server=y
)
set CLASSPATH=%DEPLOY%
for %%i in (%DEPLOY%\*.jar) do (
set CLASSPATH=!CLASSPATH!;%%i
)
for %%i in (%DEPLOY%\lib\system\*.jar) do (
set CLASSPATH=!CLASSPATH!;%%i
)
for %%i in (%DEPLOY%\lib\app\*.jar) do (
set CLASSPATH=!CLASSPATH!;%%i
)
for %%i in (%DEPLOY%\tools\jaxws-ri\lib\*.jar) do (
set CLASSPATH=!CLASSPATH!;%%i
)
set CLASSPATH=%CLASSPATH%;%DEPLOY%\resources
1 Answer