saunders - 22 Mar. 2003 - 04:09:
Drive Eject Program
Has anybody found a program that will open/close any drive?
Something simple like:
"eject.exe E"
And open or close that drive depending on whether it's already open or closed.
And on a side note, just because this seems like such a simple question, does anybody know how I could disable WinXP from creating these annoying My Pictures and My Music folders in my personal folder? I tried deleting some registry keys and it didn't work.
22 Mar. 2003 - 12:30
plastic
Red pointed to a basic eject.exe lately, if I recall correctly:
here.
Ya, but it probly won't be able to close the drive.
22 Mar. 2003 - 18:19
spyder
it didn't closed my drives on XP
so,
PKTray is an alternative to me
22 Mar. 2003 - 22:27
saunders
Red & spyder: it closed the drive for me (WinXP Pro)
Red: in another post you mentioned using a "marker" in a batch file so you could use the same shortcut to open/close the drive, how would i do this?
:Let me write a quick batch file for you.
:.Put eject.exe in a folder included in your path
:-or-
:hard code where you put eject into the code.
@echo off
if exist C:\marker.dat goto closedrive
eject e
echo This is just a marker for the eject batch file.>>C:\marker.dat
echo If it exists, the tray will retract. If not, it ejects.>>C:\marker.dat
echo Coded by Red (aka CutTheRedWire).>>C:\marker.dat
goto end
:closedrive
eject e /l
delete C:\marker.dat
:end
23 Mar. 2003 - 02:53
saunders
ohh i see
i was thinking that marker was some kind of system wide variable you could set
but that method makes sense
in fact, i'll one up you:
@echo off
if exist ejct%1.mrk goto closeIt
eject %1
echo marker >> ejct%1.mrk
exit
:closeIt
eject %1 /L
del ejct%1.mrk
exit
Usage:
eject.bat E

Oh, boy... that naming could be a problem. You have type the .bat every time. If you rename either the .exe or the .bat, then you could skip the extension.
There may be a way to have it write a variable to memory, but I've never been able to get it to keep it when the dos box closes. There might be another program to do it. I know there is one for the path, but I dount you want to screw with your path just to get this thing working.
You also could add code for a default drive.

When you just type in "eject", it would open or close e. Another idea is to have an option for all drives to open/close.

23 Mar. 2003 - 17:58
undefined
For system-wide variables, you can use
Setx, but it's for Win2000+ only (sorry Red

).
23 Mar. 2003 - 20:03
saunders
<Red> "Oh, boy... that naming could be a problem. You have type the .bat every time. If you rename either the .exe or the .bat, then you could skip the extension. "
Well I have it setup to run with
Winkey, so I wasn't really worried about that.
<Red> "You also could add code for a default drive."
Ooooh, how?
I tried writing a batch file before that tested to see if %1 was set, but I couldn't figure it out.
just a lil if work and variable replacing.
You forgot to add quotes around the variable.
See how this would work?
set drive=%1
if "%1"="" set drive=e
:assumes e is your default cd rom drive
Then you just change any %1 to %drive% and you're set.

25 Mar. 2003 - 03:34
saunders
I didn't realize that batch programming could be as powerful as that even. Thanks for the help Red.
28 Mar. 2003 - 08:17
saunders
Cool, thanks for that link.
Please log-in to post.
You need to be logged in to post. To log-in, or to register an account go -
there.
Options