You are here

DevEject Alternatives

14 posts / 0 new
Last post
Vhati
Offline
Last seen: 18 years 4 days ago
Joined: 2006-09-26 18:27
DevEject Alternatives

I used to use this batch to quickly run a script and eject.

FOR %%i in (".") do set usbdrv=%%~di

copy deveject.exe "%userprofile%\desktop"
copy startx.exe "%userprofile%\desktop"

echo deveject -EjectDrive:%usbdrv% >> "%userprofile%\desktop\bye.bat"
echo del startx.exe >> "%userprofile%\desktop\bye.bat"
echo del deveject.exe >> "%userprofile%\desktop\bye.bat"
echo del bye.bat >> "%userprofile%\desktop\bye.bat"

cd /D "%userprofile%\desktop"
startx /B bye.bat

Then I got a Lexar JumpDrive Secure, which appears to Windows as a Local Drive rather than a Removable Device. It has the advantage of using an autorun.inf like CDs so my apps start as soon as I insert the stick (SP2 adds a nag popup, but that's the only hold-up).

I had hoped to be able to use the Secure drive's autorun to start a script, eject, and move on without touching the keyboard or mouse.

This is not the case though. Deveject only seems to work for Removeable Devices even though the Windows Safely Remove Wizard doesn't distinguish between them.

Are there any other utilities to eject USB drives?

Vhati
Offline
Last seen: 18 years 4 days ago
Joined: 2006-09-26 18:27
Enabling Autorun for Removable Drives

This TechNet article suggests autorun can be enabled for Removable Drives (disabled by default), but it requires making a registry change beforehand.

Not being able to programatically remove my Secure drive still bugs me.

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 1 month ago
Joined: 2006-01-06 21:27
.

<cough>Libertà AutoStart</cough>
----
R McCue
PortaBlog Home and My Website
And before anyone complains about the grammar, I'm so jetlagged that my
hands aren't even in the same time zone...

"If you're not part of the solution, you're part of the precipitate."

Vhati
Offline
Last seen: 18 years 4 days ago
Joined: 2006-09-26 18:27
Found one

I checked out AutoStart's page, thinking it was the opposite of what I wanted, GUI.
Then I looked at its CVS and stumbled across Uwe Sieber's site, where he improved upon deveject.

Halfway down he's got Remove Drive and Eject Media.

The former worked for me for BOTH types of drives:
RemoveDrive.exe "LEXAR JUMPDRIVE SECURE USB Device"
or
RemoveDrive.exe G:

rene
Offline
Last seen: 17 years 5 months ago
Joined: 2006-03-29 16:16
Glad you found a solution

Glad you found a solution that works for you. Just wanted to let you know that the next release of autostart (so NOT 1.0.0.42 but the next) has a completely rewritten Eject Device function. It is a lot smarter than the current version and capable of handling very complex device trees with virtual CDROMS and such in it. However it is also smart enough to detect when you have a multi-card reader, it will then only eject the flash media and not remove all drives of the reader.

So wait a few days and check out the next release of autostart to have this nicely packaged up in a single little application.

I think I will make it check its own name to see if it is called AutoEject.exe if it is, then it will behave just like your batch file.

Vhati
Offline
Last seen: 18 years 4 days ago
Joined: 2006-09-26 18:27
.

> I think I will make it check its own name...
Wouldn't an optional commandline argument be a better method?

> ...it will behave just like your batch file.
Excellent.
So the tray icons, context menu, autorun watcher, and other GUI elements will be optional?
Why not make a purely commandline AutoEject.exe and have Autostart call it?

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 1 month ago
Joined: 2006-01-06 21:27
Huh?

Wouldn't an optional commandline argument be a better method?
Isn't that what he said in it will behave just like your batch file. ?
Although, I would like just a command line tool. Maybe as an extension Renè
----
R McCue
PortaBlog Home and My Website
And before anyone complains about the grammar, I'm so jetlagged that my
hands aren't even in the same time zone...

"If you're not part of the solution, you're part of the precipitate."

rene
Offline
Last seen: 17 years 5 months ago
Joined: 2006-03-29 16:16
AutoStart commandline options

Currently I support the options

-uninstall
Uninstall from the PC.
-delete_on_close
Self-destructs on exit (poof gone)
-no_main
Don't run AutoStart main functionality, so exits immediatly.

The Eject functionality would be

-eject <drivenum>
Without drivenum it ejects/unplugs the drive you are running this from. Or you can specify the drive number where drivenum 0 maps to drive letter A etc.

The name AutoEject.exe (autoeject.exe is also fine) will be shorthand for
AutoStart.exe -no_main -eject

What it does is copy AutoEject.exe to the temporary directory on the PC and then run that with AutoEject.exe <drivenum> -delete_on_close which translates into
AutoStart.exe -no_main -eject <drivenum> -delete_on_close

> Why not make a purely commandline AutoEject.exe and have Autostart call it?
Things that are separate can get lost....

Also count how many KB your exes add up to, AutoStart is well below that in size.

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 1 month ago
Joined: 2006-01-06 21:27
Like I said,

Would it be possible with the extension API? Maybe load the extension on startup?
----
R McCue
PortaBlog Home and My Website
And before anyone complains about the grammar, I'm so jetlagged that my
hands aren't even in the same time zone...

"If you're not part of the solution, you're part of the precipitate."

rene
Offline
Last seen: 17 years 5 months ago
Joined: 2006-03-29 16:16
The extension API is for

The extension API is for hooking in functionality that is not in AutoStart. Ejecting a drive is something that is already part of AutoStart and for a good reason. It is so intricately mixed up with device enumeration that it is hard to imagine it existing outside of autostart without copying a lot of autostart code.

And it IS a commandline tool when you use -no_main, because it doesn't continue running it just ejects the drive and exits without showing any GUI.
You just call it as 'AutoStart.exe -no_main -eject' from the command line.

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 1 month ago
Joined: 2006-01-06 21:27
I suppose

Mind you, it was 11 PM when I wrote that Biggrin
----
R McCue
PortaBlog Home and My Website
And before anyone complains about the grammar, I'm so jetlagged that my
hands aren't even in the same time zone...

"If you're not part of the solution, you're part of the precipitate."

Vhati
Offline
Last seen: 18 years 4 days ago
Joined: 2006-09-26 18:27
.

> The name AutoEject.exe (autoeject.exe is also fine) will be shorthand for
> AutoStart.exe -no_main -eject

Checking a filename just seems odd to me; kinda like checking datestamps or filesizes.
Usually commandline shorthand is done with a shorter arg. Here's an example from wget...

'-m' or '--mirror'
Turn on options suitable for mirroring.
This option turns on recursion and time-stamping, sets infinite recursion depth and keeps FTP directory listings.
It is currently equivalent to `-r -N -l inf -nr'.

----

> It is so intricately mixed up with device enumeration that it is hard to imagine it existing outside of autostart without copying a lot of autostart code.

I haven't looked at your code yet but if you're using an automated build system like make or ant, you could set it to
a) compile everything normally or
b) compile only sources relevant to ejecting, and include a stripped-down main() to run their functions.

----

> And it IS a commandline tool...

Understood.
I'm not flaming/trolling but a tenet of Unix philosophy comes to mind:
"Do one thing, do it well."

I'll probably end up using whatever you release.
If it's not trivial for you to make a second app, don't worry about it.
I'm just glad you're contributing to the community and taking time to listen to your users.

If it bugs me enough, I might recompile it myself with only the eject functionality.
Hooray GPL!
Smile

rene
Offline
Last seen: 17 years 5 months ago
Joined: 2006-03-29 16:16
> Checking a filename just

> Checking a filename just seems odd to me;
> kinda like checking datestamps or filesizes.

You normally don't choose these, so not kinda like.
Furthermore, a filename should say something about the function of the utility so checking whether a tool is called autoeject as a short hand for -eject -no_main is not that far fetched in my world. If it makes you uncomfortable, you could still call it autostart and create a shortcut.

> Usually commandline shorthand is done with a shorter arg.
> Here's an example from wget...

I think I have not made the idea behind this clear enough.
This shorthand naming is choosen so you don't have to give ANY arguments.
You can just run it from PStart or from the explorer.
Another way to solve this is to use a shortcut where you put the commandline arguments to AutoStart. And I suppose if you are actually running AutoStart but also want to have a quick way of ejecting from e.g. PStart you'd just call it with the right commandline arguments.

>I haven't looked at your code yet but if you're using an automated build system
>like make or ant, you could set it to

Building is just one of the many steps in releasing a utility. My main focus is on AutoStart. If there is a specialized way of using AutoStart I'm all for that. But to be honest I will never be releasing a separate AutoEject.exe.

> I'm not flaming/trolling but a tenet of Unix philosophy comes to mind:
> "Do one thing, do it well."

To which I respond :
"Make everything as simple as possible, but not simpler." Albert Einstein

But seriously, I subscribe to the intent of your statement.
AutoStart has a very focused feature set. And device ejecting is part of that feature set. The fact that reducing the functionality even further results in another utility that is also usefull doesn't mean AutoStart does too many things.

>I'll probably end up using whatever you release.
>If it's not trivial for you to make a second app, don't worry about it.
>I'm just glad you're contributing to the community and taking time to listen to >your users.
>If it bugs me enough, I might recompile it myself with only the eject >functionality.
>Hooray GPL!

Hooray indeed, you are of course welcome to do that.
But I'd wait until all the bugs have been ironed out Wink

Vhati
Offline
Last seen: 18 years 4 days ago
Joined: 2006-09-26 18:27
.

Smile Smile Smile
Well put.

I guess I skimmed over the drivenum-being-optional part the first time. Wink
So I was thinking "AutoEject.exe X:" was the only way it could be used, like deveject.

Nothing more on this from me...
Douglas McIlroy vs Einstein made my day. Blum

Topic locked