Batch Scripting

techi3

In Runtime
Messages
119
I wrote this to search my folder for all .doc files but it is not working, please help

@echo off
for %%c (c:\john\\*.doc) do echo %%c

I'm not typing it directly into the CL, I know that it doesn't like double %'s for variables
 

strollin

Knowitall!
Messages
3,447
Location
N. Calif.
You left out the word "in" in the For command and you have an extra \ in there. Try:

@echo off
for %%c in (c:\john\*.doc) do echo %%c
 

berry120

Fully Optimized
Messages
3,434
Location
UK
This is where *nix shell scripting is just, well, better!

find /usr/john -name *.doc

:)
 

strollin

Knowitall!
Messages
3,447
Location
N. Calif.
Seems about the same to me, not necessarily better or easier, just different.

The OP could actually just use the DIR command to accomplish the same thing:

@Echo off
dir c:\john\*.doc /B
 
Last edited:

berry120

Fully Optimized
Messages
3,434
Location
UK
Seems about the same to me, not necessarily better or easier, just different.
I was referring to the lack of a loop, but as you pointed out the dir command can do it pretty similarly.
 

techi3

In Runtime
Messages
119
Thanks for all the help. I finished UNIX shell scripting last week, I just started Windows batch scripting. Tonight's homework is to create a batch backup script to make a copy of each file and rename it with a different format. Then use commands to schedule the script to run daily...fun stuff.
 
Top