<p>How do I remove a USB drive using the Win32 API? I do a lot of work on embedded systems and on one of these I have to copy my programs on a USB stick and insert it into the target hardware.</p>

<p>Since I mostly work on the console I don't like to use the mouse and click on the small task-bar icon hundred times a day. </p>

<p>I'd love to write a little program to do exactly that so I can put it into my makefiles, but I haven't found any API call that does the same thing.</p>

<p>Any ideas?</p>

It looks like
Sync
lets you specify -e to eject removable drives. While not a win32 API, you could probably just call
```
sync -e [drive_letter]
```
from your makefile.