0

Suppose I have the command:

:start
if /i "%%~fs"=="%drive%" cd %%~fs&md Favorites 2>nul
if /i "%%~fs"=="%drive%" cd %%~fs&md "Discography Info" 2>nul
...
goto start

How would I loop the command and each time put in a different name?

user3093536
  • 95
  • 1
  • 7

1 Answers1

2

You can do it similar to this:

@echo off
for %%f in (*) do call :printit "%%f"
goto :end
:printit arg1
echo %~1 ---- %1
exit /b 0
:end
echo Done.
pause
djangofan
  • 28,471
  • 61
  • 196
  • 289
  • Can you loop the call :startx's as well? Or is that not possible? – user3093536 Dec 17 '13 at 00:27
  • This was actually very fun to try out and surprising in how user friendly it was, so thank you very much! – user3093536 Dec 17 '13 at 01:52
  • I'm not totally understanding your question. I think there is enough information in my answer for you to figure out a infinite loop. http://stackoverflow.com/questions/5487473/how-to-create-an-infinite-loop-in-windows-batch-file – djangofan Dec 17 '13 at 17:01