Reputation: 3
I would like to run a Visual Basic script called "cscript" on all the files in a directory, rather than a single file at a time. Is this possible?
The manual, one-at-a-time command is:
cscript "C:\Program Files\Jampal\ptts.vbs" -w sample.wav < sample.txt
Upvotes: 0
Views: 2171
Reputation: 130819
You can use a simple one liner from the command line without any need for a batch script.
I can't tell if your VB script creates the .wav file or if it uses the file.
If your script creates the .wav file, then:
for %F in (*.txt) do cscript "C:\Program Files\Jampal\ptts.vbs" -w "%~dpnF.wav" <"%F"
If your script needs both the .txt and .wav file, then you should verify both exist before attempting to process:
for %F in (*.txt) do if exist "%~dpnF.wav" cscript "C:\Program Files\Jampal\ptts.vbs" -w "%~dpnF.wav" <"%F"
Upvotes: 1