@echo off setlocal set alphabet=ABCDEFGHIJKLMNOPQRSTUVWXYZ set pfpath=%ProgramFiles(x86)% if %PROCESSOR_ARCHITECTURE% == x86 ( if not defined PROCESSOR_ARCHITEW6432 set pfpath=%ProgramFiles% ) :loop cls echo Lumistar Microcontroller Programming Script V2.0 echo M.J. Sadaway and J.W. Barrington, Computer Niches, Unlimited echo Copyright (c) 2015-2016 Research Dynamics LLC echo( ::Display list of .hex files in subdirectories of LumiStar directory. set count=0 for /f "tokens=*" %%G in ('dir /b /s lumistar\*.hex') do (call :list "%%G") echo( ::Get user's choice of .hex file to download. choice /c %alphabet% /n /m "Enter letter of .hex file to download from the above list:" ::Download selected .hex file. set basie=1 for /f "tokens=*" %%G in ('dir /b /s lumistar\*.hex') do (call :doit "%%G") pause goto :loop :list ::set letter=%alphabet:~%count%,1% doesn't work. Workaround is to use call set. set one=1 call set letter=%%alphabet:~%count%,%one%%% echo %letter% %~nx1 set /a count+=1 if %count% leq 26 goto :eof echo( echo ERROR - MORE THAN 26 .HEX FILES FOUND echo( pause goto :loop :doit if %errorlevel% neq %basie% goto :next echo %1 | findstr /l ".tiny14.hex" > nul ::echo %1 | find ".tiny14.hex" > nul if %errorlevel% neq 0 (call :DD1 %1) else (call :DD2 %1) goto :eof :next set /a basie+=1 goto :eof :DD1 echo( echo on ::Replace Digispark bootloader to remove 5-second start-up delay. "micronucleus-t85-master\commandline\builds\Windows\micronucleus.exe" "micronucleus-t85-master\upgrade\releases\micronucleus-1.06-jumper-v2-upgrade.hex" ::Download selected .hex file to Digispark. "%APPDATA%\Arduino15\packages\digistump\tools\micronucleus\2.0a4/launcher" -cdigispark --timeout 60 -Uflash:w:%1:i @echo off echo( echo DONE WITH %~nx1 echo( goto :eof :DD2 echo( echo on ::Reset first byte of EEPROM, set fuses, and download selected .hex file to ATTINY84 processor. "%pfpath%\Arduino/hardware/tools/avr/bin/avrdude" -C"%pfpath%\Arduino/hardware/tools/avr/etc/avrdude.conf" -pattiny84 -cusbtiny -Ueeprom:w:0xff:m -Uefuse:w:0xff:m -Uhfuse:w:0xdf:m -Ulfuse:w:0xe2:m -Uflash:w:%1:i @echo off echo( echo DONE WITH %~nx1 echo( goto :eof