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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run my code on several files.

Status
Not open for further replies.

hoohaahii

Programmer
Mar 6, 2011
8
GB
Hi,

I wrote a C code that converts csv files to space delimited. it works fine, but now I need to run the code on a lot of files.

is there a way to run my code on multiple files without having to do it one by one?

I don't know if this involves a C code or is it some trick to do in DOS.

I'm using visual studio, and I have windows 7 OS.

Thank you
A.Y.A
 
I cannot assure this, but selecting all the files and dragging them into the exe file could work if you don't want to write a single line.

Cheers,
Dian
 
Thank you guys,

I used the forfile command , but the problem is that my program requires two arguments which are the input file "*.csv" and an output file "*.sd", I can not figure out how to specify the output file in the forfile command! any idea?

Dian, your idea didn't work, for the same reason I think, thanks though.

Regards,
A.Y.A
 
Or modify your program so if just one parameter is informed, the output file name will be the same as the input one.

Cheers,
Dian
 
Why not use for /f

for /f %i in (*.csv) do app.exe %i

It is just standard NT command and works on all versions in the NT family tree from NT to W7.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top