Once upon a time, Ladyada did a video on a homebrew programmer built from an UNO that did repeated burns for fuses and bootloader and 'blink' sketch that her staff used when selling the naked atmega328P-PU pre-programmed chip.
From by Windows batch program, I see little reason why a sketch could not do the same. I know we used a sketch-only to put the bootloader on the Maple-Mini.
/**
*
* Maple Mini bootloader updater sketch.
* Based on sketch from Gregwar for Robotis OpenCM9.04, which is based on Maple bootloader code.
*
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
* WARNING WARNING
* WARNING This comes with NO WARRANTY, you use it at your own risk WARNING
* WARNING WARNING
* WARNING Please read this warning text and the instructions below WARNING
* WARNING WARNING
* WARNING Running this sketch will erase your bootloader replace it WARNING
* WARNING with the new STM32duino bootloader WARNING
* WARNING WARNING
* WARNING Only use this sketch with Maple mini boards. WARNING
* WARNING WARNING
* WARNING Note. If your bootloader does get messed up, it is possible WARNING
* WARNING to reflash using an external USB to Serial adaptor or another WARNING
* WARNING Arduino board (to act as a USB to Serial device) WARNING
* WARNING WARNING
* WARNING For more information see www.stm32duino.com WARNING
* WARNING WARNING
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
*
*
* Instructions.
*
* Upload this sketch onto your Maple mini.
*
* After upload the LED on the board should start to flash slowly (on for 1 sec off for 1 sec)
*
* Open the Serial Monitor and follow the on screen instructions
*
* If the version of the bootloader that is contained in this sketch is already installed,
* a message is displayed and you will not be prompted to update.
*
* If prompted to update, press Y to agree and reflash the bootloader
*
* After the update has finished, the sketch will wait for you to manually reset the board
* or to upload a new sketch
*
* If you just reset the board. This sketch will run again, as it will not be touched by the bootloader update
* However it will display the message to indicate that this bootloader has already been installed
*
* For support please register to www.stm32duino.com
*
* Credit goes to Victor PV, Matthis, Ray.
*
* For source code and binaries for the bootloader see
* www.github.com/rogerclarkmelbourne/stm32duino-bootloader
*
* See also www.rogerclark.net
*
*/
// Data of bootloader
const char maple_mini_boot20[7036] = {