批处理for循环加入jar到CLASSPATH

main.bat

 1 @echo off
 2 set CLASSPATH=D:\.Lab\classes
 3 pushd ".\lib"
 4 for %%i in ("*.jar") do call :appendcp "%cd%\%%i"
 5 popd
 6 echo CLASSPATH=%CLASSPATH%
 7 pause
 8 exit
 9 
10 :appendcp
11 for /f "tokens=*" %%v in (%1) do set CLASSPATH=%CLASSPATH%;%%v
12 goto :eof

 

posted @ 2019-06-01 23:54  RMS365  阅读(...)  评论(... 编辑 收藏