• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 381
  • Last Modified:

FOR loop can't find fileset.

I have a DOS batch file (win2k) that takes one arguement of a set of files, uses that arguement in a FOR /F statement and runs a utility for each of the entries on each of the lines, for each of the files that the FOR /F loop goes through.

I swear it worked 6 months ago, and now I need to run it again, and it keeps telling me "The system cannot find the file" of the arguement I put into the batch..

For example, lets say I have some files that end in .txt in a directory, so I run my batch with the *.txt arguement.
Instead of going through each *.txt file in the directory and running the FOR loop, it'll only give me the message "
The system cannot find the file *.txt.

What could I possibly be doing wrong?

here's the file...

echo Called with %1
FOR /F %%a in (%1) do C:\m2o\awk95 -f c:\m2o\sortu.awk < %%a > _%%a
echo "Done!"
0
Beaker1974
Asked:
Beaker1974
  • 2
1 Solution
 
SteveGTRCommented:
I'd get rid of the /F and give it a try.
0
 
Beaker1974Author Commented:
That worked!  Why would the /F be the problem?
0
 
SteveGTRCommented:
That's used to work on the output from commands one line at a time or to read the contents of a file one line at a time. Each line is referenced using %%a.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now