Guest Charles Posted September 15, 2007 Posted September 15, 2007 Hello I have a very simple question. I am totally new to batch files and I am looking to create the following: a batch file that takes every file and folder in a directory, and opens it with a specific program (exactly in the same way as if I drag and drop each file or folder on the program in windows). Problem: the program only works with one file at a time (so I can't just drag and drop all the files of the directory in one shot). It would be even better if that script would also do it for any sub directory. I would imagine the syntax would be fairly easy but I can't find on google an example doing what I want to do. Would anyone here be kind enough to give me a hand? thanks in advance Charles
Guest Detlev Dreyer Posted September 15, 2007 Posted September 15, 2007 Re: Question batch files "Charles" <spam@cmichel.net> wrote: > I have a very simple question. I am totally new to batch files and I > am looking to create the following: a batch file that takes every file > and folder in a directory, and opens it with a specific program > (exactly in the same way as if I drag and drop each file or folder on > the program in windows). Problem: the program only works with one file > at a time (so I can't just drag and drop all the files of the > directory in one shot). It would be even better if that script would > also do it for any sub directory. If the program allows for one instance only, a batch file wouldn't help either. You may want to try out at the DOS prompt: Change the directory and try to run several documents at the same time, having that supported ..xyz (example) file extension. Enter CD ... (adapt) Start Document1.xyz (adapt) Start Document2.xyz (adapt) -- d-d
Guest Pegasus \(MVP\) Posted September 15, 2007 Posted September 15, 2007 Re: Question batch files "Charles" <spam@cmichel.net> wrote in message news:1189851732.912302.72140@y42g2000hsy.googlegroups.com... > Hello > > I have a very simple question. I am totally new to batch files and I > am looking to create the following: a batch file that takes every file > and folder in a directory, and opens it with a specific program > (exactly in the same way as if I drag and drop each file or folder on > the program in windows). Problem: the program only works with one file > at a time (so I can't just drag and drop all the files of the > directory in one shot). It would be even better if that script would > also do it for any sub directory. > > I would imagine the syntax would be fairly easy but I can't find on > google an example doing what I want to do. Would anyone here be kind > enough to give me a hand? > > thanks in advance > Charles > You could try this: @echo off for %%a in (*.*) do start "" "%%a" or this: @echo off for /F "tokens=*" %%* in ('dir /s /b /a-d') do start "" "%%*" Post again if you need some clarification.
Guest Charles Posted September 15, 2007 Posted September 15, 2007 Re: Question batch files Thanks. That's really helpful. It looks like the function FORFILES does the same thing in cmd. But it doesn't like it's installed on my computer. I will try your script Thanks! Charles
Recommended Posts