Last active
June 30, 2021 20:23
-
-
Save pferreirafabricio/1eae02c6f315c8c62de43478d4475421 to your computer and use it in GitHub Desktop.
Making PowerShell talk
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
<# | |
Usage example: | |
./Speak-Powershell.ps1 "Hy PowerShell" | |
#> | |
Add-Type -AssemblyName System.speech | |
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer | |
$textToSpeak = switch ( [String]::IsNullOrEmpty($args[0]) ) { | |
$true { "Hello World" } | |
$false { $args[0] } | |
} | |
$speak.Speak($textToSpeak) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment