Created
March 31, 2023 14:37
-
-
Save stduhpf/897683b2c09d26619448206dee510682 to your computer and use it in GitHub Desktop.
Play notification sound from powershell script
This file contains 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
Add-Type @" | |
using System; | |
using System.Runtime.InteropServices; | |
public class SoundPlayer { | |
[DllImport("winmm.dll")] | |
public static extern bool PlaySound(string pszSound, IntPtr hmod, uint fdwSound); | |
} | |
"@ | |
# You can change the path to any wav file you want to play | |
[void][SoundPlayer]::PlaySound("C:\Windows\Media\tada.wav", [System.IntPtr]::Zero, 0x20000) |
This file contains 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
#!/bin/bash | |
# Call the "tada.ps1" powershell script from WSL's shell | |
powershell.exe -ExecutionPolicy Bypass -File tada.ps1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment