# Solved: help with batch script



## 450 (Jul 1, 2014)

I'm new to this and would greatly appreciate help creating a script. Working with windows xp- I'm trying to simplify this repetitive command on MS-DOD.
V:\convert\library
I press p to start a program that processes a file. 
Each time I have to press p to start the .exe 
I load the file by typing in the name and hitting return to run it. 
To load the next file I have to press p again and load the next file by typing it in.

Is there a way to simplify this as a batch action. What I'm trying to do iso drop files in a folder and run a script that looks at the folders directory and loads it for me.


----------



## foxidrive (Oct 20, 2012)

Provide further information about the task - you might get a solution using different techniques, or a solution that uses your program.


----------



## 450 (Jul 1, 2014)

V:\convert\Secndary
In this folder I have a p.exe that runs .pfo files
My files are stored in the same folder in order for the p.exe to see them.

When I run the p.exe the following displays

Preload list files
Enter input file name:

I input the file name and it will process my file. It displays the output file name. 

Once it finishes with the file im back to V:\convert\Secndary

This is where it becomes repetitive since I have to repeat the steps for 100 files. 
Each time at this point entering p to run the p.exe and having to type in the next file name.

Is there anyway you know of to have it load each file so I don't have to manually type it all in?


----------



## foxidrive (Oct 20, 2012)

It depends on how the exe file is written and if it can accept redirected input - try this:


```
@echo off
cd /d "V:\convert\library"
for /f "delims=" %%a in ('dir /b /a-d *.pfo ') do (
echo %%a| p.exe
)
```
Some programs have command line options also.


----------



## 450 (Jul 1, 2014)

I'm afraid that you are correct. Unfortunately it doesn't accept redirected input. 

Thank you for your help.


----------



## foxidrive (Oct 20, 2012)

Does this type a name into the p.exe?


```
@echo off 
cd /d "V:\convert\library" 
for /f "delims=" %%a in ('dir /b /a-d *.pfo ') do ( 
>tmp echo %%a
 p.exe <tmp
 )
del tmp 2>nul
```


----------



## 450 (Jul 1, 2014)

thank you so much for your help. yes that did work.

i found a read me file that stated 1 at a time. not sure why but ill have to proof my file for errors but looks like everything works. 

Thank you again for all your help.


----------



## foxidrive (Oct 20, 2012)

I'm glad to hear it is working. 

Just to clarify (from your tests) it does accept redirected input, but doesn't accept piped input.


----------



## 450 (Jul 1, 2014)

Thank you for clarifying that. I'm still trying to get somewhat good at this. So far all is well.

Thanks again


----------

