windows batch command for loop set environment variable
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to find a way to dynamically build en environment variable that contains a list of JAR files under my app's WEB-INF/lib folder. This is what I have so far, but it's over-writing itself each time, so when you reach the end of the loop, you just have the last file from the loop set in the variable. SETLOCAL ENABLEDELAYEDEXPANSION for %%f IN (WEB-INF/lib/*.jar) DO ( SET JAR_LIST=%JAR_LIST%;%%f ) ECHO JAR_LIST -- %JAR_LIST% So this produces... C:\apache\Tomcat6.0\webapps\myapp>(SET JAR_LIST=.;xsltcbrazil.jar ) C:\apache\Tomcat6.0