Question batch files

C

Charles

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
 
D

Detlev Dreyer

Charles said:
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)
 
P

Pegasus \(MVP\)

Charles said:
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.
 
C

Charles

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top