Batch Problem Using a For Loop

W

whitesmith

I'm writing a batch file that displays all the subdirectories under
the current directory. So I wrote:
for %%d in (dir *.* /b /s) do echo %%d
which produces this output:
dir
/b
/s
Not exactly what I wanted! So then I tried a simplification:
for %%d in (*.*) do echo %%d
which produces no output at all! I've used for loops like this in
batch files a zillion times before with predictable results. Can
anyone suggest what's wrong? I'm running XP Pro with SP3. Auto-
updating is turned on. The box has 1.5 GB of RAM and a 320 GB hard
drive. The OS passes Windows Genuine Advantage validation.

Many thanks to all who reply.
 
J

Jim

I'm writing a batch file that displays all the subdirectories under
the current directory. So I wrote:
for %%d in (dir *.* /b /s) do echo %%d
which produces this output:
dir
/b
/s
Not exactly what I wanted! So then I tried a simplification:
for %%d in (*.*) do echo %%d
which produces no output at all! I've used for loops like this in
batch files a zillion times before with predictable results. Can
anyone suggest what's wrong? I'm running XP Pro with SP3. Auto-
updating is turned on. The box has 1.5 GB of RAM and a 320 GB hard
drive. The OS passes Windows Genuine Advantage validation.

Many thanks to all who reply.

Karenwares Directory Printer ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top