Take the 2-minute tour ×
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)
:nofolder
cls
echo No folders found
pause
goto end
:display
cls
echo One or more folders found
pause
goto end
share|improve this question
add comment

1 Answer

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

Your Answer

 
discard

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.