FOR loop can't find fileset.

Posted on 2007-07-26
Last Modified: 2010-04-16
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!"
Question by:Beaker1974
    LVL 30

    Accepted Solution

    I'd get rid of the /F and give it a try.

    Author Comment

    That worked!  Why would the /F be the problem?
    LVL 30

    Expert Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
    Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now