cmd script count

August 27, 2011 at 11:28:00
Specs: Windows XP
set targent_G=c:\work\g\
set cashe_G=%temp%2.txt
dir /s/b/o:n/a:-d %targent_g%*.pdf>%cashe_g%

I need to count the number of *.pdf in %cashe_g%

See More: cmd script count

Report •

August 27, 2011 at 16:15:51
Firstly %temp% usually doesn't come with a trailing backslash, so it is best to add one.

set targent_G=c:\work\g\
set cashe_G=%temp%\2.txt
dir /s/b/o:n/a:-d "%targent_g%*.pdf">"%cashe_g%"

for /f %%a in ('find /i /c ".pdf" ^< "%cashe_g%"') do set pdfcount=%%a

Report •
Related Solutions

Ask Question