Spin down and safely eject a USB hard disk

Started by SimplySimon, January 02, 2018, 06:17:59 AM

Previous topic - Next topic

SimplySimon

I am very new, so if this subject has been dealt with please feel free to point me in the right direction,

I am looking at doing two things:

1 writing a script that will copy files to a hard disk connected by USB to Port_#0002 Drive letter e:

2 when the files have been copied, to power or spin down the drive and safely eject it.

I have used
DiskScan(64 ) which lists the drive
xEjectMedia("e:") which does nothing except returning 1 which I assume is success, but as this is not a CD or Jaz drive nothing happens.

Any pointers would be good

Simon

td

In testing, xEjectMedia generally does eject USB drives.  However, USB drives often do not "spin down" because they are ejected.    You have to either physically turn them off or unplug them in most cases.  Also, don't confuse the state of the media with the presence of the icon in the notification area of the taskbar.   xEjectMedia uses the same method used by the Windows shell.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade