When a forced command is asked, we need to unset the specified USB VID/PID to be able to find the device in BOOTSEL mode (which uses Raspberry VID/PID).
The following lines can be added:
settings.vid = -1;
settings.pid = -1;
before or after
reboot_device(to_reboot, to_reboot_handle, true, 1);
in main.cpp.
Combined with #260 I am able to re-program my RP2040 USB device running any USB class on Windows without debug probe or BOOTSEL button with a single command line.
picotool load -x path\to\project.elf --vid YOUR_VID --pid YOUR_PID -f