Batch get variable's value
===

I have the following code:

    for /f "tokens=*" %%p in (input.txt) do (
    echo %%p
    cd %%p
    set /a c = 0
    for %%f in (*) do (
    echo %%f
    if not exist *test*.* (
    set /a c += 1
    )
    )
    if %%c GTR 0 echo %%p >>folders.txt
    cd ..
    )

But the last if statement is not working. I want to know what do I have to do to have access to the variable c that I set up in the first for. I've tried different combinations like !c! or %c% but nothing seems to work. What am I missing?