这个 vbs 较简单 (在自己电脑, 1=第一个CDROM, 2=第2个):
On Error Resume Next
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
colCDROMs.Item(1).Eject
A1= Msgbox ("Press The OK Key To Close The CD" , 0 + 32,"Close CD")
colCDROMs.Item(1).Eject
或较复杂, but 没有要自行关 wscript.exe:
复制程式
On Error Resume Next
Const Hidden = 0, Normal = 1, Min = 2
Dim Act : Set Act = CreateObject("Wscript.Shell")
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
colCDROMs.Item(1).Eject
A1= Msgbox ("Press The OK Key To Close The CD" , 0 + 32,"Close CD")
colCDROMs.Item(1).Eject
Act.Run("%comspec% /c TASKKILL /F /T /IM Cscript.exe"),Hidden,True
Act.Run("%comspec% /c TASKKILL /F /T /IM Wscript.exe"),Hidden,True
Act.Run("%comspec% /c TASKKILL /F /T /IM Wmiprvse.exe"),Hidden,true