Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I define that 0 (number zero) folders are located within the current directory?. I´m asking this due to within a batch program, I cant make that this condition be true in order to go to nofolder subprocess.

@echo off
set count=
for /d %%a in (*) do set /a count+=1
if %count%==0 (goto nofolder) else (goto display)
echo No folders found
goto end
echo One or more folders found
goto end
share|improve this question

1 Answer 1

up vote 1 down vote accepted

%count%==0 will never be true because count is never set to zero.

Change set count= to set "count=0"

share|improve this answer
Great, it really help me a lot, thanks – frantika Feb 27 '13 at 18:38
@frantika Glad to help. – David Ruhmann Feb 27 '13 at 19:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.