How can I mute/unmute my sound from PowerShell

后端 未结 10 2189
孤独总比滥情好
孤独总比滥情好 2020-11-29 06:14

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 fi

10条回答
  •  渐次进展
    2020-11-29 06:31

    I know it isn't PowerShell, but combining the answers from Michael and Diogo gives a one-line VBScript solution:

    CreateObject("WScript.Shell").SendKeys(chr(173))
    

    Slap this in mute.vbs, and you can just double-click to toggle mute

    • still works in Windows 10 (10586.104)
    • no need to Set-ExecutionPolicy as you might with PowerShell

提交回复
热议问题