:: Invoke this script in either of the following two ways
:: wav2pcm.bat - Here no argument is given and hence the converted pcm files are stored in C:\Inetpub\ftproot\pcm\ringtone
:: wav2pcm.bat arg1 - Here arg1 is the location specified where the pcm files are stored. Examples of specifying arg1: C:\temp OR C:\temp\ OR "C:\temp" OR "C:\temp\"
@echo Command Invoked = %0 %1
if {%1}=={} goto blank
if not {%1}=={} goto specific
:blank
echo Create default directory
SET MYPATH=C:\Inetpub\ftproot\pcm\ringtone
echo %MYPATH%
md %MYPATH%
goto end
:specific
echo Create argument directory
:: this removes double quotation from the argument
SET MYPATH=%~1
:: this removes the trailing \ from the argument if it is present
IF %MYPATH:~-1%==\ SET MYPATH=%MYPATH:~,-1%
echo %MYPATH%
md %MYPATH%
goto end
:end
FOR %%A in ("C:\inetpub\ftproot\wav\ringtone\*.wav") DO C:\inetpub\ftproot\wav\ringtone\ffmpeg -i %%A -f s16le -acodec pcm_s16le -y "%MYPATH%\%%~nA.pcm"