Shutting down the hard drive

How can you disconnect a hard drive? I want to do this in order to be able to safely delete my sata drive, even if it is hotplug. WMI doesn't seem to have a method.

+3
source share
2 answers

Using WMI, you can open the "Eject Disk" dialog box using:

Shell "Rundll32.exe Shell32.dll Control_RunDLLA hotplug.dll", vbNormalFocus

Alternatively, if you want to remove the device programmatically, you need this MSDN article . This should work with sata drives, if you can extract them manually, then you can “extract” them programmatically.

+2
source

Solution without any popup dialogs:

just use

sync

from cygwin (sync - coreutils)

+2

Source: https://habr.com/ru/post/1707549/


All Articles