机箱没有选好, 光盘的出仓/收仓键被挡住了, 用起来很别扭. 记得有一款小软件可以控制光驱的出仓与收仓. 搜索了一下使用的Windows API. 编写了下面的代码, 希望大家喜欢:
PS C:UsersEden> $a = Add-Type -memberDefinition @"
>> [DllImport("winmm.dll", CharSet = CharSet.Ansi)]
>> public static extern int mciSendStringA(
>> string lpstrCommand,
>> string lpstrReturnString,
>> int uReturnLength,
>> IntPtr hwndCallback);
>> "@ -passthru -name mciSendString
>>
PS C:UsersEden> $a::mciSendStringA('set cdaudio door open', $null, 0,0); # 打开光驱
0
PS C:UsersEden> $a::mciSendStringA('set cdaudio door closed', $null, 0,0); # 关闭光驱
0
最后给大家附上今天为大家总结的在控制台的所有快捷键, 方便大家使用PowerShell. 实际上Cmd.exe或任何控制台都支持这些快捷键的.










