1

I can eject a network drive using net use X: /DELETE but when I try to use this same command on removable media I get an error:

The network connection could not be found.

More help is available by typing NET HELPMSG 2250.

Yes, obviously it isn't a network connection, so how do I eject the device from a script?

1
  • 1
    This is not a duplicate of the other question. That question is about removing a USB device; this is about ejecting a removable media. Using the solutions in the other question will remove the drive which is not the same as ejecting the media in the drive. If you eject a memory-card from a card-reader, then you can take the card out and plug another one in and start using it. If you remove it, the whole reader will be removed and it will be a real pain to get it back.
    – Synetech
    May 1, 2016 at 22:59

1 Answer 1

2

There doesnt appear to be a built in Windows command to do this. There may be scripting functionality in VBScript or PowerShell, but I didnt see any.

However, you are not the only person to ask this. I found this in a quick Google search. Some C++ code to compile to give you a CLI command to eject media. Look at the first answer to the question for a link to the code.

Here is a precompiled program that does something similar.

5
  • Wow, I'm surprised this isn't possible without external software. I would rather just pull the card than have to go to all this trouble.
    – Michael
    Apr 24, 2013 at 5:07
  • just be sure to enable "quick removal" so you dont corrupt your data
    – Keltari
    Apr 24, 2013 at 5:15
  • i'll make sure that's enabled. however, it should be safe anyway if i'm not writing the drive, right? i'm basically just running an asset import script which only reads data off the device.
    – Michael
    Apr 24, 2013 at 5:17
  • If you arent writing to the drive, in theory the cache doesnt need to be flushed... but you never know... better safe than sorry, right?
    – Keltari
    Apr 24, 2013 at 5:19
  • 1
    It looks like the Freeject tool actually does eject removable media without removing the drive. Finally a solution. Thanks!
    – Synetech
    May 1, 2016 at 22:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .