Created
March 28, 2017 01:40
-
-
Save Sh1n0g1/3cbc620a55d0dcbef9beaef7a5470dbd to your computer and use it in GitHub Desktop.
Open CD Tray by PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$MemDef =@" | |
[DllImport("winmm.dll", CharSet = CharSet.Ansi)] | |
public static extern int mciSendStringA( | |
string lpstrCommand, | |
string lpstrReturnString, | |
int uReturnLength, | |
IntPtr hwndCallback | |
); | |
"@ | |
$winmm = Add-Type -memberDefinition $MemDef -ErrorAction 'SilentlyContinue' -passthru -name mciSendString | |
$winmm::mciSendStringA("set cdaudio door open", $null, 0,0) | |
#Got a hint from http://stackoverflow.com/questions/3797141/programmatically-opening-the-cd-tray |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment