Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
batch: iterating through all files in a dir
Name: SlowJoe Date: December 7, 2000 at 02:00:21 Pacific
Comment:
Hello, I'd like to use a program, that needs a single file as parameter. Im my directory there are lot's of *.java-files I want to use the program with. Could anyone tell me how is the syntax for iterating through all files and run the program in every step? I thought of something like: foreach (*.java) { program $_; } (a little perl-like ;) )
Name: Ginger Grant Date: December 7, 2000 at 04:45:11 Pacific
Reply:
How about: for %%a in (*.java) do program$_ %%a
0
Response Number 2
Name: slowjoe Date: December 8, 2000 at 07:42:54 Pacific
Reply:
Thank you, Ginger!
That does the work as expected. By the way "$_" is a standard variable in Perl. In my perl-like code snippet it should represent the parameter that is given to the program "program".
Summary: I want to rename all files in a directory. All of the files are in the form of Axxx.gif and I want to rename them to xxxB.gif. Can you help me to write such a batch file ? I am using win95. Thanks...
Summary: I need to have the following batch file run the OSQL statement against every .SQL file in the current directory osql -U %USER_NAME% -P %PASSWORD% -S localhost -d %DATABASE% -i aaa.sql -o result.txt ...
Summary: Hi, I would like to loop through each file in a dir and set a variable each time to = that filename without the extension. ie. if filename = temp.rtf then set filevar = temp. Here is the code I've be...