I'm building the variable CLASSPATH dynamically from a list of " *.jar" files that are located in a sibling directory named "lib". Hopefully that batch file (I want to call it a script, but this isn't Unix land) makes sense.
REM (Note: Borrowed this approach from theįor %%i in (.\lib\*.jar) do call cpappend.bat %%i REM To be clear, CPAPPEND.BAT builds the JARS variable. REM then append that variable to the CLASSPATH. REM Call the CPAPPEND.BAT program to build the JARS env variable, It has a " for" loop, and in that for loop I call the second script ( CPAPPEND.BAT), like this:
In this case my script is named runit.bat. The first script is the one you want to build. To accomplish the desired effect you need two scripts. Sure enough it was in there, and I'd like to share it here. I couldn't get a lot of obvious approaches to work, but then remembered I had seen a trick back in the release of Jakarta Tomcat 3.3.x. This variable had to be built correctly for my Java application to work properly. In this case I was trying to build a variable named CLASSPATH from a collection of Java JAR files in a sibling directory named LIB. The basic problem was that I needed to build an environment variable dynamically. I don't work in the DOS (Windows command ( CMD.EXE)) world too much these days, but I needed to today. Using an ad blocker? just a $2 donation at will help keep this site running