windows - Batch File folder detection -


yes, know need double-up %a %%a when used in batch file. ;)

this works, not give me results want - much..

for /f %a in ('dir "d:\tomcat*" /ad /b ')  /f %b in ('dir "d:\%a\webapps" /ad /b ') echo d:\%a\webapps\%b 

what is:

for /f %a in ('dir "d:\tomcat*\webapps" /ad /b ')  echo %a 

but, resulting error:

the filename, directory name, or volume label syntax incorrect.

i have need detect folders have tomcat in them , of following:

d:\tomcat d:\tomcat1 d:\tomcat2 d:\tomcat_1 etc. 

thanks!

you use if exist

for /f %a in ('dir "d:\tomcat*" /ad /b ')  if exist "%~a\webapps\nul" dir /b "%~a\webapps" 

\nul check if folder exist.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -