TechTalkz.com Logo Ask the Experts!

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Microsoft > Windows XP

Eject/Load DVDROM device from Command line in XP

Windows XP

 
 
Thread Tools Display Modes
Unread 28-01-2008, 05:45 AM   #1
SAI
Guest
 
Posts: n/a
Eject/Load DVDROM device from Command line in XP

I'd like to know if there are any specific commands to open/eject and load a
CD/DVD device from command prompt.

I dont want to use any utilities/downloads for the above purpose.
 
Unread 28-01-2008, 05:45 AM   #2
Mark L. Ferguson
Guest
 
Posts: n/a
RE: Eject/Load DVDROM device from Command line in XP

Create this file in the C: root
(assumes CD drive letter is D: )
--EjectCD.vbs-- cut here--
Set objShell = CreateObject("Shell.Application")
Set MyComp=objShell.NameSpace(17)
Set CD=MyComp.ParseName("D:\")
Set Context=CD.Verbs
CD.InvokeVerb "E&ject"
--end file--cut---

Then, from the prompt

start C:\EjectCD.vbs
--
helpful? click "Yes" button. Voting helps the web interface.
Holiday Lights: http://www.geocities.com/marfer_mvp/Xmaslgt.zip
Mark L. Ferguson



"SAI" wrote:

> I'd like to know if there are any specific commands to open/eject and load a
> CD/DVD device from command prompt.
>
> I dont want to use any utilities/downloads for the above purpose.

 
Unread 28-01-2008, 05:45 AM   #3
SAI
Guest
 
Posts: n/a
RE: Eject/Load DVDROM device from Command line in XP

thanks, it works fine.

how can i "load" in the same way as eject??

"Mark L. Ferguson" wrote:

> Create this file in the C: root
> (assumes CD drive letter is D: )
> --EjectCD.vbs-- cut here--
> Set objShell = CreateObject("Shell.Application")
> Set MyComp=objShell.NameSpace(17)
> Set CD=MyComp.ParseName("D:\")
> Set Context=CD.Verbs
> CD.InvokeVerb "E&ject"
> --end file--cut---
>
> Then, from the prompt
>
> start C:\EjectCD.vbs
> --
> helpful? click "Yes" button. Voting helps the web interface.
> Holiday Lights: http://www.geocities.com/marfer_mvp/Xmaslgt.zip
> Mark L. Ferguson
>
>
>
> "SAI" wrote:
>
> > I'd like to know if there are any specific commands to open/eject and load a
> > CD/DVD device from command prompt.
> >
> > I dont want to use any utilities/downloads for the above purpose.

 
Unread 28-01-2008, 05:46 AM   #4
Mark L. Ferguson
Guest
 
Posts: n/a
RE: Eject/Load DVDROM device from Command line in XP

Aside from a reboot, which would close the drawer, then you could do a

'CD.InvokeVerb "&Open" '

I know of no software interface to close it.

--
helpful? click "Yes" button. Voting helps the web interface.
Holiday Lights: http://www.geocities.com/marfer_mvp/Xmaslgt.zip
Mark L. Ferguson



"SAI" wrote:

> thanks, it works fine.
>
> how can i "load" in the same way as eject??
>
> "Mark L. Ferguson" wrote:
>
> > Create this file in the C: root
> > (assumes CD drive letter is D: )
> > --EjectCD.vbs-- cut here--
> > Set objShell = CreateObject("Shell.Application")
> > Set MyComp=objShell.NameSpace(17)
> > Set CD=MyComp.ParseName("D:\")
> > Set Context=CD.Verbs
> > CD.InvokeVerb "E&ject"
> > --end file--cut---
> >
> > Then, from the prompt
> >
> > start C:\EjectCD.vbs
> > --
> > helpful? click "Yes" button. Voting helps the web interface.
> > Holiday Lights: http://www.geocities.com/marfer_mvp/Xmaslgt.zip
> > Mark L. Ferguson
> >
> >
> >
> > "SAI" wrote:
> >
> > > I'd like to know if there are any specific commands to open/eject and load a
> > > CD/DVD device from command prompt.
> > >
> > > I dont want to use any utilities/downloads for the above purpose.

 
Unread 28-01-2008, 05:52 AM   #5
SAI
Guest
 
Posts: n/a
RE: Eject/Load DVDROM device from Command line in XP

1. http://forums.pcpitstop.com/lofivers...p/t143721.html

2. http://www.virtualplastic.net/msgboa...m=0&thread=158

3. This following one I downloaded from somewhere over the net, cant
remember where I got this code from??? Me think, its written in C++. Thought
it should shed some light on what I asked for, CLOSING the drive tray. FYI.
------------------------------------------------------------------------------------------------
//
// AUTHOR
// N. Nielsen
//
// LICENSE
// This software is in the public domain.
//
// The software is provided "as is", without warranty of any kind,
// express or implied, including but not limited to the warranties
// of merchantability, fitness for a particular purpose, and
// noninfringement. In no event shall the author(s) be liable for any
// claim, damages, or other liability, whether in an action of
// contract, tort, or otherwise, arising from, out of, or in connection
// with the software or the use or other dealings in the software.
//
// SUPPORT
// Send bug reports to: <nielsen@memberwebs.com>
//


#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

#include <windows.h>
#include <tchar.h>
#include <winioctl.h>

// Get first CD-ROM Drive letter
TCHAR GetCDROM()
{
TCHAR buff[4];
TCHAR i;

_tcscpy(buff, "X:\\");

for(i = _T('A'); i <= _T('Z'); i++)
{
buff[0] = i;
if(GetDriveType(buff) == DRIVE_CDROM)
return i;
}

return 0;
}

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{

TCHAR buff[7];
HANDLE hDevice;

// Create a CD-ROM drive string
_tcscpy(buff, "\\\\.\\X:");
buff[4] = GetCDROM();

if(buff[4] == 0)
{
MessageBox(NULL, _T("No CD-ROM drives found on system."), _T("Eject"),
MB_OK | MB_ICONSTOP);
return 2;
}

// Open the CD device
hDevice = CreateFile(buff, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);

if(hDevice != INVALID_HANDLE_VALUE)
{
DWORD code = IOCTL_STORAGE_EJECT_MEDIA;
DWORD bytesRet = 0;

// If specified with the '-load' parameter then load
// the drive rather than eject
if(strstr(lpCmdLine, "-load"))
code = IOCTL_STORAGE_LOAD_MEDIA;

DeviceIoControl(hDevice, code, NULL, 0, NULL, 0, &bytesRet, NULL);
}

return 0;
}

------------------------------------------------------------------------------------------------



"Mark L. Ferguson" wrote:

> Aside from a reboot, which would close the drawer, then you could do a
>
> 'CD.InvokeVerb "&Open" '
>
> I know of no software interface to close it.
>
> --
> helpful? click "Yes" button. Voting helps the web interface.
> Holiday Lights: http://www.geocities.com/marfer_mvp/Xmaslgt.zip
> Mark L. Ferguson
>
>
>
> "SAI" wrote:
>
> > thanks, it works fine.
> >
> > how can i "load" in the same way as eject??
> >
> > "Mark L. Ferguson" wrote:
> >
> > > Create this file in the C: root
> > > (assumes CD drive letter is D: )
> > > --EjectCD.vbs-- cut here--
> > > Set objShell = CreateObject("Shell.Application")
> > > Set MyComp=objShell.NameSpace(17)
> > > Set CD=MyComp.ParseName("D:\")
> > > Set Context=CD.Verbs
> > > CD.InvokeVerb "E&ject"
> > > --end file--cut---
> > >
> > > Then, from the prompt
> > >
> > > start C:\EjectCD.vbs
> > > --
> > > helpful? click "Yes" button. Voting helps the web interface.
> > > Holiday Lights: http://www.geocities.com/marfer_mvp/Xmaslgt.zip
> > > Mark L. Ferguson
> > >
> > >
> > >
> > > "SAI" wrote:
> > >
> > > > I'd like to know if there are any specific commands to open/eject and load a
> > > > CD/DVD device from command prompt.
> > > >
> > > > I dont want to use any utilities/downloads for the above purpose.

 
Unread 28-01-2008, 06:12 AM   #6
Swifty
Guest
 
Posts: n/a
Re: Eject/Load DVDROM device from Command line in XP

Mark L. Ferguson wrote:
> I know of no software interface to close it.


Try wizmo from Gibson Research.

wizmo quiet close

I put "open" and "close" on keystrokes Ctrl+J and Ctrl+Shift+J (J for
eJect) using "The Wonderful Icon".

I'm just too lazy to reach over to poke the button on the drive.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
 
 

Thread Tools
Display Modes



< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT. The time now is 09:46 AM.


vBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2013, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional