@echo off

c:\windows\system32\mode com1: BAUD=115200 PARITY=N DATA=8 STOP=1

if exist %1.hex goto download1
if exist %1     goto download2
goto error

:download1
type %1.hex >com1
goto end

:download2
type %1 >com1
goto end

:error
echo Error: file '%1.hex' or '%1' not found!

:end
@echo on