Have you test this=
lexikos wrote:
Code: Select all
SetWorkingDir % A_WinDir Eject(A_ScriptDir)
lexikos wrote:
Code: Select all
SetWorkingDir % A_WinDir Eject(A_ScriptDir)
Code: Select all
DriveGet, VAR, Type, % DRV := SubStr( DRV, 1, 1 ) ":"
If ( VAR = "" )
Return ( ErrorLevel := -1 ) + 1
If ( VAR = "CDROM" ) {
Drive, Eject, %DRV%
If ( nTC + 1000 > A_Tickcount )
Drive, Eject, %DRV%, 1
Return ( ErrorLevel ? 0 : 1 )
Try this:What I've done is replace DRV with X (the name of my EHDD) and it did not work..
I would like to know how this works please..
Code: Select all
Eject( "X:" )
MsgBox %A_LastError%
Cited from https://support.microsoft.com/en-us/help/4051300/windows-10-safely-remove-hardwareLook for the Safely Remove Hardware icon on the taskbar. If you don't see it, select Show hidden icons . Press and hold (or right-click) the icon and select the hardware you want to remove.
I have tried in vain, several years ago. Will try again and shall post if I find anything useful.
Code: Select all
hdid= USB\VID_174C&PID_55AA\35600000000000001A9B ;example
hdid=*35600000000000001A9B* ; you can use *
run, %A_ScriptDir%\RestartSrDev.exe %hdid% -f -na -d
Code: Select all
for k, hdId in getHardwareID47()
run, %A_ScriptDir%\RestartSrDev.exe %hdid% -f -na -d
return
getHardwareID47(){
hwid := []
for objItem in ComObjGet("winmgmts:").ExecQuery("SELECT * FROM Win32_USBHub where ConfigManagerErrorCode=47"){
hwid.Push(objItem.deviceid)
}
return hwid
}