Flashing throw serial as soon as device connected to USB

I use local particle-cli to flash device with USB. It is ask press Enter when device connected.
(my device wake up one time in day and then sleep again for 24 hour)
I have to catch this 20 second working time during day to change my firmware. It is any way
to make some batch file under Windows (to check if we have com COM port connected try to flash without ENTER key and if not success wait 2 second and try again till not flash with good result)

May be somebody have ideas about it?

How about using safe mode?

I don’t have phisical access to device … only over remote desktop soft. Any possibility to put in safe mode with software?

You could create a cloud function that sets it to Safe mode when it wakes up, or even flashes it over the cloud as soon as it gets online.
Alternatively, there's this neat trick:

cloud functions you mean in particle cloud (in web hooks or somethink? you have some examples for that) or have to use 3rd side server…

Considering you need to have your computer running anyhow, you can have that trigger a function that will put it into safe mode as soon as it comes online. Then you can flash it OTA if you so desire.