Batch file to list all subfolder paths
<p>I am trying to write a command that runs from location of the program. The program asks user to type in a folder to search for, when the folder is found, I need a list of directories to its subfolders. Below is my code so far: </p>

<pre><code>ECHO OFF
ECHO Enter name for your target search folder
SET /P searchf=[Please type desired search forder]
for /d %%a in ("%searchf%".) do dir /ad /on /s /b "%%a" &gt;&gt; %searchf%.txt
GOTO End
:End
</code></pre>

<p>Assuming the target folder is called "<code>test</code>", I want to have a result like this:</p>

<pre><code>C:\Users\IT\test\pany\all
C:\Users\IT\test\ondy\part\clear
C:\Users\IT\pany\test\check\apps
C:\Users\IT\pand\all\check\test
</code></pre>

<p>So far my code returns dir till where the "test" was found.</p>