Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .