for loop

important page: http://www.robvanderwoude.com/for.php

 

some explanation in the below example:

 

 

for /f %%i in ('dir /b /on %exchangesim_home%\lib\exchangesim-*.jar') do set exchangesim_jar_file=%exchangesim_home%\lib\%%i

 

 

 

this code won't work as you think. The reason is because, %exchangesim_home% will be explained as soon as the command start. So, it will look like:

 

exchangesim_jar_file=.\lib\%%i

 

 

The workaround is, like this:

 

=================================================

 

in env-viperooe.bat

set VIPEROOE_CLASSPATH=.

for /f %%i in ('dir /b /on .\lib\*.jar') do set-viperooe_classpath.bat %%i

echo %VIPEROOE_CLASSPATH%

 

in set-viperooe_classpath.bat

 

set VIPEROOE_CLASSPATH=%VIPEROOE_CLASSPATH%;.\lib\%1

 

 

 

 =

================================================

 

@echo offsetlocal

set exchangesim_home=%~dp0

call %exchangesim_home%\env-exchangesim.bat

set instancename=fooset jflags=-ms64M -mx1024M -Xnoclassgcset mainclass=com.citigroup.get.quantum.lifecycle.LifeCycleManager

 

set tt_lic=%TT_HOME%\license\tcm.licset classpath=%classpath%;configset classpath=%classpath%;%EXCHANGESIM_CLASSPATH%

 

set opts=%opts% -Djava.library.path=%LD_LIBRARY_PATH%

set opts=%opts% -Djava.util.logging.config.file=config\logging.properties

set opts=%opts% -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger

set opts=%opts% -Djava.security.policy=config\allperms.policy

set opts=%opts% -Dtt.licensefile=%tt_lic%

set opts=%opts% -Dviperooe.instance=%instancename%

 

for /f %%i in ('dir /b /on %exchangesim_home%\lib\exchangesim-*.jar') do set exchangesim_jar_file=%exchangesim_home%\lib\%%i

 

mkdir %exchangesim_home%\config\exchangesim\%instancename% 2> nul

 

start "exchangesim - %instancename%" /D%exchangesim_home% %JAVA_HOME%/bin/java %jflags% -classpath %classpath%;%exchangesim_jar_file% %opts% %mainclass% config

 

exchangesim %instancename%endlocal

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值