PowerShell打开或关闭光驱
机箱没有选好,光盘的出仓/收仓键被挡住了,用起来很别扭.记得有一款小软件可以控制光驱的出仓与收仓.搜索了一下使用的WindowsAPI.编写了下面的代码,希望大家喜欢:
PSC:\Users\Eden>$a=Add-Type-memberDefinition@"
>>[DllImport("winmm.dll",CharSet=CharSet.Ansi)]
>>publicstaticexternintmciSendStringA(
>>stringlpstrCommand,
>>stringlpstrReturnString,
>>intuReturnLength,
>>IntPtrhwndCallback);
>>"@-passthru-namemciSendString
>>
PSC:\Users\Eden>$a::mciSendStringA('setcdaudiodooropen',$null,0,0);#打开光驱
0
PSC:\Users\Eden>$a::mciSendStringA('setcdaudiodoorclosed',$null,0,0);#关闭光驱
0
最后给大家附上今天为大家总结的在控制台的所有快捷键,方便大家使用PowerShell.实际上Cmd.exe或任何控制台都支持这些快捷键的.
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短