Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

batch program for each file in directory 2

Status
Not open for further replies.

Kurt111780

Technical User
Nov 20, 2003
235
GB
Hello,

I'm not sure if this is the right forum. I'm using windows xp and need to create a simple command line program. This is what it needs to do for each file in the directory. fileName1 representing the first file in the directory.

For each file in myDirectory do myCommand fileName1 -options

Thanks,
Kurt

It's only easy when you know how.
 
At a command line, type 'Help For' without the ticks. That should get you started.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Hi, I looked at that but I'm having a hard time understanding it. It looks like I need to send the filenames to a text file first?

Thanks,
Kurt

It's only easy when you know how.
 
for %i In (C:\*.*) DO @Echo FOO: %i

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
I output the directory listing to a file like this:

dir /B *.zip >temp.txt

Now I need to loop through each filename and run my command.

Kurt

It's only easy when you know how.
 
did you run the command I posted?


[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
i've got a little program that will do that for whatever files you want in a directory. it builds a file called
selected.bat you can then do (from the command line)
>selected yourcmd
where yourcmd is whatever the command is (and add options at the end /whatever).(> added to show prompt only not typed
in.)


it's called execbat.exe (source code included)

it was intended to be used with a compiler aid for QuickBasic that i wrote so that i could compile a whole group of programs rather than one at a time.

It was based on the THEOS operating system command FILELIST
with the EXEC option.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top