如何从PowerShell静音/取消静音 [英] How can I mute/unmute my sound from PowerShell

查看:241
本文介绍了如何从PowerShell静音/取消静音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试编写一个PowerShell cmdlet,它将在开始时将声音静音(除非已被静音),并在结束时将其取消静音(仅当它没有被静音时才开始). 找不到我可以使用的任何PoweShell或WMI对象.我正在使用诸如auxGetVolume 之类的Win32函数或 auxSetVolume ,但无法完全实现工作(如何从IntPtr读取值?).

Trying to write a PowerShell cmdlet that will mute the sound at start, unless already muted, and un-mute it at the end (only if it wasn't muted to begin with). Couldn't find any PoweShell or WMI object I could use. I was toying with using Win32 functions like auxGetVolume or auxSetVolume, but couldn't quite get it to work (how to read the values from an IntPtr?).

我正在使用V2 CTP2.大家有什么想法吗?

I'm using V2 CTP2. Any ideas folks?

谢谢!

推荐答案

似乎没有一种快速简便的方法来调节音量..如果您有c ++的经验,则可以使用

There does not seem to be a quick and easy way to adjust the volume.. If you have c++ experience, you could do something with this blog post, where Larry Osterman describes how to call the IAudioEndpointVolume interface from the platform api(for Vista, XP might be more difficult from what I've found in a few searches).

V2确实允许您编译内联代码(通过Add-Type),因此可以选择.

V2 does allow you to compile inline code (via Add-Type), so that might be an option.

这篇关于如何从PowerShell静音/取消静音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆