Skip to content

Instantly share code, notes, and snippets.

@M3T4L5T3F
Last active January 14, 2019 23:28
Show Gist options
  • Save M3T4L5T3F/51cd735e6873b5275d67688f1d351607 to your computer and use it in GitHub Desktop.
Save M3T4L5T3F/51cd735e6873b5275d67688f1d351607 to your computer and use it in GitHub Desktop.
Windows Command line speech - PowerShell
# Use Windows Speech engine with PowerShell
#
# Usage example: powershell .\PSSay.ps1 'This is a test'
#
# Thanks to Greg Foss for the original example!
# https://gist.github.com/gfoss
param( [string]$comment = $_ )
Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
#Options you can tweak below: Female-Male-Neutral
# There are also 'age' settings in the .NET documentation that I haven't dug into yet.
$speak.SelectVoiceByHints('Female')
$speak.Speak("$comment")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment