Abhishek Ginani
Abhishek Ginani

Reputation: 4751

How to get the number of files in directory in variable in windows batch file

I have tried following command to do this but it's not working :

for /f "delims=" %%i in ('dir "d:/Database/BARC/" /b/a-d | find /v /c "::") do set count=%%i 

It is showing some error like unexpected error. How to round this error?

Upvotes: 1

Views: 54

Answers (1)

npocmaka
npocmaka

Reputation: 57252

@echo off
for /f "delims=" %%i in ('dir "d:/Database/BARC/" /b/a-d ^| find /v /c "::"') do set count=%%i 
echo %count%

Upvotes: 2

Related Questions