Welcome Guest ( Log In | Register )

Discover the best free computer help!
Learn more about Geeks to Go by taking the tour. Spyware, virus, trojan, fake security or privacy alerts? Read the malware cleaning guide.
      
 
Reply to this topicStart new topic
Batch file for ejecting media
maxedison
post Apr 7 2008, 08:20 AM
Post #1


New Member
*
Posts: 1
OS: Windows XP



I currently have a batch file that will run the Safely Remove Hardware function (the same thing as double clicking on the safely remove hardware button in the system tray).

What I would really like, however, is for the batch file to actually go ahead and eject a specific media. Since my external hard drives always have the same drive letters, I feel like this should be possible.

Here's the text of the current batch file I'm using in case it helps. By the way, I know nothing about any of this programming.

REM SAFEREMOVE.BAT

echo off
echo SAFELY REMOVE
echo Starting Safely Remove
%windir%\system32\RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll
Go to the top of the page
 
+Quote Post
Ax238
post Apr 8 2008, 10:49 PM
Post #2


TA Moderator
Group Icon
Posts: 1,275
From: SET HOMEPATH
OS: Windows 95/98/2000/XP/Vista



Welcome to Geeks to Go!

If you are trying to eject media from the your CD-ROM, you can use a VBS file for this. Save the following code as eject.vbs and then just run it using cscript.exe eject.vbs (or just double-click it if you want to test it).

Opening a CD drive:
CODE
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection

if colCDROMs.Count >= 1 then
        For i = 0 to colCDROMs.Count - 1
                colCDROMs.Item(i).Eject
        Next ' cdrom
End If


If this isn't what you're looking for, please let me know.

Ax
Go to the top of the page
 
+Quote Post
aikeru
post Apr 23 2008, 11:13 AM
Post #3


New Member
*
Posts: 8
OS: Windows XP Pro SP2 / Vista Ultimate



Mmmm sounds like it's not really "eject" but you want your USB devices "safely removed" automatically rather than having to do it yourself.

Here's a link that seems to have the information you need to get started:
http://portableapps.com/node/639

smile.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies / Views Topic Information
No New Posts 0 / 338 5th August 2007 - 09:19 PM
shoryuken25 started - last by shoryuken25
No New Posts   7 / 1,065 14th May 2008 - 08:18 AM
bshaw started - last by sari
No New Posts   3 / 1,170 4th August 2008 - 08:55 AM
bombasos2 started - last by Swandog46
No New Posts 0 / 28 20th November 2008 - 06:51 PM
Dimension started - last by Dimension

RSS Time is now: 22nd November 2008 - 08:30 AM
Advertisements do not imply our endorsement of that product or service. The forum is run by volunteers who donate their time and expertise. We make every attempt to ensure that the help and advice posted is accurate and will not cause harm to your computer. However, we do not guarantee that they are accurate and they are to be used at your own risk.