1

I am putting a batch together to run a propitiatory audio converter. The batch works, you put it into a folder and dump each file you need to convert into the same folder, it loops through each one and outputs the converted file into a folder names converted. When you run it, it sits there until completed. What I am trying to do is at the beginning of each loop say something like "converting file 1" "converting file 2" and so on so the user can see some progress. I just have no clue how to add that in. Here is what I have so far.

@echo off
color Fc
echo Remember to put this program and the audio files to convert into the same folder!!!!!
pause
if not exist converted MD converted
for /r . %%f in (*.wav) do "C:\Program Files\Verint\Playback\CommandLineConvertor.exe" "%CD%\%%~nxf" "%CD%\converted\%%~nxf"
echo All files have been converted
pause
end

Thanks!

1 Answer 1

3

You can change your DO to multiple lines, and echo in the loop, like this:

for /r . %%f in (*.wav) do (
    ECHO Converting %%f . . .
    "C:\Program Files\Verint\Playback\CommandLineConvertor.exe" "%CD%\%%~nxf" "%CD%\converted\%%~nxf"
)
echo All files have been converted

Alternately, if you want to show the whole path, just echo the first parameter you used, like this:

for /r . %%f in (*.wav) do (
    ECHO Converting "%CD%\%%~nxf" . . .
    "C:\Program Files\Verint\Playback\CommandLineConvertor.exe" "%CD%\%%~nxf" "%CD%\converted\%%~nxf"
)
echo All files have been converted

EDIT:

It would help if I read your requirement fully. You can increment a number like this:

Add setlocal ENABLEDELAYEDEXPANSION after @ECHO OFF to enable delayed expansion of variables. Then, before the loop, initialize your variable:

SET /a x=0

Then in your loop, increment the variable and ECHO it, giving you this:

@echo off
setlocal ENABLEDELAYEDEXPANSION
color Fc
echo Remember to put this program and the audio files to convert into the same folder!!!!!
pause
if not exist converted MD converted
SET /a x=0
for /r . %%f in (*.wav) do (
    SET /a x=x+1
    ECHO Converting file !x! . . .
    "C:\Program Files\Verint\Playback\CommandLineConvertor.exe" "%CD%\%%~nxf" "%CD%\converted\%%~nxf"
)
echo All files have been converted
pause
end
Sign up to request clarification or add additional context in comments.

12 Comments

This will work perfectly if i cant figure out counting, only down side is this audio files have pretty long names, so if I can keep the output a little cleaner that would be great, but great idea I didnt even think about just displaying the file name.
+1. @brock029, as an additional feature, it's easy to include the total number of files in the message like, 'Converting file 1 of 25 . . .', useful if it runs with lots of files. To implement this run a copy of the for loop once first without the audio processing command, or echo. Keep the set but change the var to filecount (don't forget to SET /a filecount=0 before the loop). Then in the main loop ECHO Converting file !x! of !filecount! . . .. Just a suggestion.
@brock029, Are the output files .wav and in the same dir? Is it possible you're picking them up? Add code to print the file name out so you can see what's going on.
No the new files should not be picked up if they are in a separate dir.
@LittleBobbyTables no problem and thanks to you and jimhark for helping me get this worked out!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.