Thanks, Crackoo ... This seems to open up the remove hardware window for you to make a selection. Is there a way to identify only the USB flash drive and eject it?
Do you know the drive letter of the flash drive ?
If this is the case then you may try to use the FolderItem.InvokeVerb method of the Shell.Application object.
I found this code to dismount the USB drive... my problem is, how do you remount it? The system sees it in disk management, but it acts dismounted. Any ideas? Thanks
Code:
Set shell = WScript.CreateObject("WScript.Shell")
shell.Run "mountvol E: /d"
Geates ... thanks for the reply. I am a little ignorant to this as I have not used it before. Could you give an example of that method? I'm not sure about the path and volume name.
I'm in the same boat. Microsoft defines the VolumeName argument as "Specifies the volume name that is the target of the mount point. The volume name is of the form \\?\Volume{GUID}\, where {GUID} is a globally unique identifier (GUID) (for example, \\?\Volume\{2eca078d-5cbc-43d3-aff8-7e8511f60d0e}\)."
In order to mount a path to a volume, you need to know the GUID of the volumn you want to mount to. To get the GUID for the c: drive, issue a [tt]"mountvol c: /l"[/tt]. For me, the result is \\?\Volume{821c2cc7-42f9-11e1-ba53-806e6f6e6963}\. So if I want to mount the EXISTING path "f:\disk" to the c: drive, I would issue [tt]"mountvol f:\disk \\?\Volume{821c2cc7-42f9-11e1-ba53-806e6f6e6963}\".
Unfortunately, I cannot get this thing to work from the command line (I'm using Win7x64 - admin privledges). It's not much more additional info but
Geates, thanks a lot for your help and time with this. I did find a little more about the volume name, and the link you sent is interesting, so I will have to play around a little bit. Seems so odd there doesn't appear to be a simple way to eject a USB flash drive. I like the small piece of code above from crackoo, but it only opens the stop window for selecting a device.
Thanks PHV ... that IS a simple way and I will make good use of that line of code. I couldn't find anything like it with all of my searching. But the good thing is, I learned plenty of new things along the way. Many thanks to ALL!!!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.