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

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -