I have a *.bat file where I am trying modify java CLASSPATH env variable. I need to include all files found in folder and it's sub-folders except all the '*log4j.jar' files.
I can list the files I need in the cmd using the following command:
dir /s /b /a-d | findstr /v /r ".*\log4j.jar"
The following command iterates trough all the file path results and prints them out.
@Echo OFF
set TEST=
FOR /F "Tokens=*" %%A IN (
'dir /s /b /a-d ^|findstr /v /r ".*\log4j.txt"'
) DO (
Echo %%A
REM Set "TEST=%TEST%;%%A"
)
Echo %TEST%
In the above snippet I have commented my attempt to concatenate the results in a variable called TEST.
The command I am trying does not work. It looks like it stops after the first result.
How can I concatenate all the path results in a ';' separated string?