Skip to content

Instantly share code, notes, and snippets.

@theTonyHo
Created July 18, 2019 23:49
Show Gist options
  • Save theTonyHo/de6806b7ca9b018edbe24f0f1cc59509 to your computer and use it in GitHub Desktop.
Save theTonyHo/de6806b7ca9b018edbe24f0f1cc59509 to your computer and use it in GitHub Desktop.
@echo off
REM SOURCE:
REM http://stackoverflow.com/questions/19467792/batch-command-line-to-eject-cd-tray/28422571#28422571
echo Set oWMP = CreateObject("WMPlayer.OCX.7") >> %temp%\temp.vbs
echo Set colCDROMs = oWMP.cdromCollection >> %temp%\temp.vbs
echo For i = 0 to colCDROMs.Count-1 >> %temp%\temp.vbs
echo colCDROMs.Item(i).Eject >> %temp%\temp.vbs
echo next >> %temp%\temp.vbs
echo oWMP.close >> %temp%\temp.vbs
%temp%\temp.vbs
timeout /t 1
del %temp%\temp.vbs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment