@echo Wav2wav is running...
@rem open console, change to directory
@rem and start batch with "wav2img FILENAM" (without .wav)
@rem FileToOpen needed: http://www.horstmuc.de/win/wfile.zip
@echo off
if not exist GetFName.cmd (
	%~d0
	cd %~dp0
)
if not exist GetFName.cmd if exist ..\GetFName.cmd cd ..
call SHARPSET
set fnamex=.WAV
set fnamedp=%RECDIR%\
if "%RECDIR%" == "" set fnamedp=%WAVDIR%\
set fnamen=%1
set fnamef=%fnamedp%%fnamen%%fnamex%

Rem Note: Filenames with 1-7 characters are recommended!
if not exist %fnamef% call GetFName %fnamedp% "*%fnamex%" "%1"
if not exist %fnamef% (
             echo Error: File %fnamef% does not exist! - Ctrl+C
             goto end
)

rem @echo on
wav2bin --pc=%SHARPC% --type=img %fnamef% %TEMP%\%fnamen%.TMP %WAV2OPT% %2 %3 --parameters
@echo off
if errorlevel 9 goto skip1
if errorlevel 1 goto end
echo.
type %TEMP%\%fnamen%.CFG
echo.
pause
if %fnamef%=="%WAVDIR%\%fnamen%.wav" (
    echo Copy existing wav file to *.BAK...
    copy %WAVDIR%\%fnamen%.wav %fnamedp%%fnamen%.BAK
)
rem @echo on
bin2wav %TEMP%\%fnamen%.TMP %WAVDIR%\%fnamen%.wav %BIN2OPT% -d%SHARPDEV% --parameters
@echo off
if errorlevel 1 goto end
echo.
echo Test the new wav file %WAVDIR%\%fnamen%.wav 
echo Start CLOAD ? and press a key ....
pause
start "%fnamen%" %PLAYER% %WAVDIR%\%fnamen%.wav
del %TEMP%\%fnamen%.TMP
del %TEMP%\%fnamen%.CFG
goto :EOF

:skip1
echo ---------------------------------------------
echo.
echo Please read the messages above!
pause

goto :EOF
:end
pause