Reputation: 89
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!
Upvotes: 1
Views: 6973
Reputation: 32680
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
Upvotes: 3