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 生日广州男生祝福语简短