使用PowerShell命令弹出光驱:
$colCDROMs = ( new-object -COM WMPlayer.OCX.7 ).cdromCollection
for ( $i = 0; $i -lt $colCDROMs.count ; $i++ ) { $colCDROMs.Item( $i ).eject( ) }
使用CMD命令弹出光驱:
mshta “javascript:new ActiveXObject(‘WMPlayer.OCX’).cdromCollection.Item(0).Eject();window.close();”
使用VBS脚本,关闭所有光驱(注意:复制到编辑器后替换下双引号和中横线为英文标点):
Set objWMP = CreateObject(“WMPlayer.OCX.7”)
Set colCDROMs = objWMP.cdromCollection
If colCDROMs.count >= 1 Then
Do
For I = 0 To colCDROMs.count – 1
colCDROMs.Item(I).Eject
Next
Loop
End If
如果需要关闭指定光驱:
Set wmp = CreateObject(“WMPlayer.OCX.7”)
Set cdrom = wmp.cdromCollection
cdrom.Item(0).Eject
另外:由于使用以上脚本可能会出现运行后wscript.exe进程不能自动退出的问题。于是自己用C#写了一个命令行工具:该工具运行后会弹出当前系统上所有的光驱。注意:此工具需要.NET Framework 2.0。点击下载UninstallCDROM
使用PowerShell装载和卸载ISO:
装载:Mount-DiskImage -ImagePath “E:\windows_10_1607.iso”
卸载:Dismount-DiskImage -ImagePath “E:\windows_10_1607.iso”
转载请注明:悠悠猴 » Windows上用命令弹出光驱.
Warning: A non-numeric value encountered in E:\home\LocalUser\534909\www\wp-content\themes\d5\functions.php on line 334
UninstallCDROM失效了,能不能发一个到邮箱?xlp.web@live.com,谢谢!
Warning: A non-numeric value encountered in E:\home\LocalUser\534909\www\wp-content\themes\d5\functions.php on line 334
链接已经修复了.