Jump to content

Auto-eject USB devices


ning
 Share

Recommended Posts

I have several USB memory sticks that I use a lot. I'm getting annoyed having to click the little icon to unplug them, and then getting a message that it's not ready to be unplugged, and having to click 'OK' and then repeat the process. OK, it's not going to kill me, but meh, why not have a script do it?

You can probably do this neater using DLL calls, but this is all I've found so far. You need DevEject, a simple command-line program. I also use WinKey to assign programs (and scripts) to the Windows key + something - so I've set Win+Q to this script for ultimate laziness.

ben

[edit: You need the beta version to run this! As an aside, does anyone know when the next version (presumably incorporating those oh-so-useful StdOutRead, StdErrRead functions) will be released?]

Unplug_devices.au3

Edited by ning
Link to comment
Share on other sites

You can either set the devices to allow write caching or not, with write caching off, it's possible to remove the device without fear of losing data. In Device Manager, double click on the drive, click on the Policies tab and you should have the option for Optimize for quick removal and Optimize for performance, which then allows you to set cache settings.

Edited by archrival
Link to comment
Share on other sites

I think the Policies tab that archrival mentions only appears in WinXP. I have Win2k, and it's not there. There is a greyed-out tick box marked 'Write cache enabled', which is unchecked, but Windows still complains if you just pull a drive out, even if it's definitely not being written to.

Oh, and ryeguy - I do know AutoIt has a hotkey function - I'm talking about being able to call a script using a hotkey, rather than a specific function of a running script.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...