Created
October 12, 2025 19:48
-
-
Save enyone/d0e3ce523e0b693b6c00be5554a7cfd7 to your computer and use it in GitHub Desktop.
Windows microphone mute toggle scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $source = @" | |
| [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow(); | |
| [DllImport("user32.dll")] public static extern IntPtr SendMessageW(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); | |
| private const int WM_APPCOMMAND=0x319; | |
| private const int APPCOMMAND_MICROPHONE_VOLUME_MUTE=0x180000; | |
| public static void MicMute(IntPtr h) { | |
| SendMessageW(h, WM_APPCOMMAND, h, (IntPtr)APPCOMMAND_MICROPHONE_VOLUME_MUTE); | |
| } | |
| "@ | |
| add-type -name CSharp -member $source -namespace Local; | |
| [Local.CSharp]::MicMute([Local.CSharp]::GetForegroundWindow()); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Companion helper script
MicMute.jsRun with