10

If you eject a USB flash drive in Windows and do not remove it from the port, you cannot access it any more unless you remove it from the port and plug it in again.

How can you access it again without removing it and plugging it back in again? Is there a command or script I can use?

Wes Sayeed
  • 13,662
  • 6
  • 41
  • 76
Suraj
  • 103
  • 1
  • 4

1 Answers1

9

You can run Uwe Sieber's RescanDevices utility:

When an IDE or SATA drive has been prepared for safe removal it can be reactivated by a scan for new hardware. That's what this tool initiates.

It is a ... Windows application. It does the same as Microsoft's tool DEVCON when called with parameter 'rescan', but no console window pops up.

There is no user interface or prompting, you simply run it.

Additionally his RestartSrDev utility which restarts "Safely Removed" devices which have the "Code 21" or "Code 47" problem code might also be useful.


If you manage to obtain a copy of MS' DevCon (see my answer here for some links) then you can use that instead as well:

devcon restart <hardware or device instance ID>

Use devcon status * or devcon hwids * or devcon findall =usb to find the hardware ID, or you can do it manually by checking the properties of every root hub listed in Device Manager for your USB drive:

1

Once you've located the drive, check its properties to figure out the Device Instance ID from the Details tab. Once you've done all that something like devcon restart "USB\VID_0781&PID_7113" should do the trick.

Of course you can leave out all the device ID business and try devcon restart * as well for a more heavy-handed approach.

Karan
  • 55,947
  • 20
  • 119
  • 191
  • 1
    "If it's non-interactive and invisible, how to you execute it?" - Umm, simply run it? Your ejected drives should hopefully be remounted when you do so. I edited the answer above to add more info about RestartSrDev and DevCon. – Karan Apr 20 '15 at 08:15
  • 1
    @fixer1234: Invisible is obvious (no UI), and non-interactive means there's no prompting or anything. I don't see why those terms are so confusing and had to be edited out. Oh well... – Karan Apr 20 '15 at 08:26
  • Feel free to roll it back if you think it is important. I found it confusing and figured others might, also. Your explanation makes sense but it wasn't self-evident (maybe just use your explanation rather than the quoted terms?). It made something trivial (run the program) sound potentially more complicated, like perhaps someone needed to read a manual to know how to solve what was asked in the question (like the problem with link-only answers), when that isn't the case. You cleared up the questions and expanded it into a good answer, which I upvoted. – fixer1234 Apr 20 '15 at 08:42
  • It's ok, I would have rolled back if I felt that strongly about it. My comment above should be enough if anyone has doubts regarding those terms. Thanks for the edit/clarification and the upvote. :) – Karan Apr 20 '15 at 08:47