@echo off
set P=%~dp0
pushd %P%
for /f "delims= " %%A in ('sg_scan.exe ^| find /I "leapster"') do set DEVICE=%%A
if "%DEVICE%" == "" goto no_device

echo Found Leapster device at %DEVICE%

python make_cbf.py -k mrfusion.bin -o mrfusion.cbf
python upload.py -f mrfusion.cbf -d %DEVICE%
pause
popd
goto :eof

:no_device
echo Leapster device not found!
pause
popd