Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Detect and Eject Removable Disk in cmd  (Read 7910 times)

0 Members and 1 Guest are viewing this topic.

behad-007

  • Guest
Detect and Eject Removable Disk in cmd
« on: July 27, 2011, 12:51:04 AM »
hi
how can i create the batch file to detect and eject removable drive automatically ????
tnx

Transfusion



    Mentor

  • STUPID=Smart Talented Unique Person In Demand
  • Thanked: 105
    • Yes
    • Yes
    • Yes
  • Computer: Specs
  • Experience: Familiar
  • OS: Linux variant
In Soviet Russia, iPhone touch you. Computer shut you down. Mouse click you. Floppy inserts you. Yahoo answers you. Man in TV watches you. Computer game addicts you. Guitar shreds you. Motherboard fries you. The laughter in manslaughter is put back in.
Giveaway of the Day" style="border: none

behad-007

  • Guest
Re: Detect and Eject Removable Disk in cmd
« Reply #2 on: July 27, 2011, 02:44:33 AM »
tnx for reply,
but i want to detect usb mass drive and eject it. (something like safe remove!)

Sidewinder



    Guru

    Thanked: 139
  • Experience: Familiar
  • OS: Windows 10
Re: Detect and Eject Removable Disk in cmd
« Reply #3 on: July 28, 2011, 11:10:00 AM »
Wlll not eject automatically.  USB stick is  safe to remove manually at any time.

That advice is reckless. Delayed write and programs that have a file open on the device will not take too kindly to your yanking the device from the port.

Could not find a script to do a safe remove but you can enter this command in a batch file which will present the GUI:

Code: [Select]
RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll

There are also third party programs which claim to accomplish this. Google will be helpful here.

Good luck.  8)

BTW: Didn't Rock Hudson die some years ago. Good to see the cemetery crowd on CH.
The true sign of intelligence is not knowledge but imagination.

-- Albert Einstein

patio

  • Moderator


  • Genius
  • Maud' Dib
  • Thanked: 1769
    • Yes
  • Experience: Beginner
  • OS: Windows 7
Re: Detect and Eject Removable Disk in cmd
« Reply #4 on: July 28, 2011, 12:56:16 PM »
Quote
Wlll not eject automatically.  USB stick is  safe to remove manually at any time.

Agreed ...shifty advice at best.
" Anyone who goes to a psychiatrist should have his head examined. "

Fred35



    Rookie

    Thanked: 3
    • Experience: Beginner
    • OS: Unknown
    Re: Detect and Eject Removable Disk in cmd
    « Reply #5 on: July 28, 2011, 05:46:31 PM »
    Tnx for reply,
    but i want to detect usb mass drive and eject it. (something like safe remove!)

    Transfusion wrote:
    "Something like this?
    http://www.911cd.net/forums//index.php?s=924b5513860a93a2c9bef812b0718a05&showtopic=13917&pid=132133&st=0&#entry132133"

    The Transfusion method Is for a CD drive with a door.  The OP,behad-007,  is concerned with  a USB storage device.

    _______________________________________ ______

    There is safely remove USB icon at the lower right.

    Remove USB drive when Safely Remove Hardware icon appears at the lower right.

    Fred35



      Rookie

      Thanked: 3
      • Experience: Beginner
      • OS: Unknown
      Re: Detect and Eject Removable Disk in cmd
      « Reply #6 on: July 29, 2011, 04:35:12 PM »
      Transfusion wrote:
      "Something like this?
      http://www.911cd.net/forums//index.php?s=924b5513860a93a2c9bef812b0718a05&showtopic=13917&pid=132133&st=0&#entry132133"

      The Transfusion method Is for a CD drive with a door.  The OP,behad-007,  is concerned with  a USB storage device.

      _______________________________________ ______

      There is safely remove USB icon at the lower right.

      Remove USB drive when Safely Remove Hardware icon appears at the lower right.

      _______________________________________ _____
      When icon does not appear do:

      RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll

      http://ask-leo.com/safely_remove_hardware_where_did_the_icon_go_how_do_i_safely_remove_hardware_without_it.html

      behad-007

      • Guest
      Re: Detect and Eject Removable Disk in cmd
      « Reply #7 on: July 30, 2011, 04:36:30 AM »
      thanks to all for reply,
      this code was very helpful :)

      RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll