How to access an ejected USB flash drive without removing and plugging it back in [duplicate]

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?


Solution 1:

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.