How to eject CD using WMI and Python?
Using Windows' WMI library, how can I eject CD rom mounted in a specific CD/DVD drive? I am asking for sources from WMI docs or examples since I am using wmi.py library on Python. It would be great if solution satisfies Windows computer newer than Windows 2000 and having multi CD-ROMs. (i.e. I have D: F: drives and both are CD-ROM drives. I might want to eject cd in F: specifically.) Searched on the net but could not find anything relevant. The last solution must be having 3rd party binaries and executing from the shell. You can use ctypes . import ctypes ctypes.windll.WINMM.mciSendStringW(u