DriveGet, list, list
loop,Parse,list
{
  popDriver:=A_LoopField . ":"
  DriveGet, type, type, %popDriver%
  if(type == "Removable")
  {
    hVolume := DllCall("CreateFile", Str, "\\.\" . popDriver
      , UInt, 0x80000000 | 0x40000000
      , UInt, 0x1 | 0x2
      , UInt, 0
      , UInt, 0x3
      , UInt, 0, UInt, 0)
    if hVolume <> -1
    {
      DllCall("DeviceIoControl", UInt, hVolume , UInt, 0x2D4808
        , UInt, 0, UInt, 0, UInt, 0, UInt, 0 , UIntP, dwBytesReturned
        , UInt, 0)
      DllCall("CloseHandle", UInt, hVolume)
    }
  }
}

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。