2

As a Linux user I know that I can use command-line in Linux to eject/insert CD/DVD. Namely, the command to eject CD/DVD drive is eject /dev/sr0 (or simply eject) and the command to insert CD/DVD drive is eject -t /dev/sr0 (or simply eject -t).

Now, is it possible to do the same in Windows from CMD or PowerShell? Using Cygwin or WSL would be cheating so they don't count. I know I can use Windows' GUI to eject CD/DVD drive but not to insert it.


My question has been proposed as a duplicate of this question. But I think that is only partially true. I will now explain why I think so.

It is easy to see that this question only asks for the command that ejects CD/DVD drive. My question asks for the commands that eject and insert CD/DVD drive. Therefore, answers to that question only answer one part of my question.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
Hanlon
  • 551
  • 1
  • 7
  • 21
  • Go with the cmd `powershell (New-Object -com "WMPlayer.OCX.7").cdromcollection.item(0).eject()` solution since it's not drive letter specific and seems to work on Windows 10 and is a one-liner. – Vomit IT - Chunky Mess Style Jun 29 '18 at 11:15
  • CD drives don't have a concept of open or closed. Sending the eject when it is open will close it. If possible. My cd drive by the way does not have a powered close. – EBGreen Jun 29 '18 at 13:19

0 Answers0