mikeage.net Logo
mikeage.net/2006/09/27/ejecting-removable-media-from-the-command-prompt/

mikeage.net @ י׳ אייר תשע״ח

Ejecting Removable Media from the Command Prompt

How often have you wanted to be able to eject a CD, disconnect an MP3 player / USB key, etc., from the command line?

With a small little utility (courtesy of Microsoft (and me)), you can!

Knowledge Base article 165721 explains how to do this in Windows NT, 2000, and XP. They give some sample source code, which you can download and compile.

Or, you can download the same thing here!

I took their code, changed two calls to wsprintf to use sprintf, and compiled it using cl eject.c to compile with the command line compiler from Visual Studio 6.

Download source: eject.c and executable: eject.exe

For anyone who can compile this themselves, I would encourage you to do so. For anyone who can't, you can use the compiled executable here (usual warnings about trusting executables downloaded from the Internet, etc, etc)

One Response to “Ejecting Removable Media from the Command Prompt”

  1. steve cragg says:

    thank you Mike – I often attempt to eject a USB drive using the XP 'safely remove' function – hard drives; archos; iRiver etc – but XP isn't dependable – so will use your routine to speed things up.
    Ta

Leave a Reply

Quick Map
Content +
Personal +
Archives +
Site Stuff +
RBS Weather +
Search +
Recent Images

Valid XHTML 1.1!
Printer Friendly Page
 

Last Modified: September 04, 2006 @ 02:11 CST

Memory(TRUE): 4194304/4194304
Memory(FALSE): 2999536/3009520