@echo Wav2MC is running...
@rem open console, change to directory
@rem and start batch with "wav2MC 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%;*.tap" "%1"
if not exist %fnamef% (
             echo Error: File %fnamef% does not exist! - Ctrl+C
             goto end
)

rem @echo on
wav2bin -m --pc=%SHARPC% --type=bin %fnamef% %BINDIR%\%fnamen%.BIN %WAV2OPT% %2 %3
@echo off
rem if errorlevel 9 goto skip1
if errorlevel 1 goto end

:skip1
echo ---------------------------------------------
echo.
echo Note the start address, please read the messages above!
pause

start "%fnamen%" %HEDITOR% %BINDIR%\%fnamen%.BIN
goto :EOF
:end
pause
