Share this page 

Use Microsoft Speech API (SAPI)Tag(s): WSH VBScript


The Microsoft Speech API is included with XP (or higher).
Dim oVo
Set oVo = Wscript.CreateObject("SAPI.SpVoice")

If oVo Is Nothing Then
   WScript.Exho "FAILED Sapi.SpVoice creation"
Else
   Set oVo.Voice = oVo.GetVoices.Item(0) ' Man voice, for woman use 1
   oVo.Speak "Real's How To"

   Set oVo.Voice = oVo.GetVoices.Item(0)
   ' Microsoft Sam (the default voice), to hear the description of the voice
   ' oVo.Speak oVo.GetVoices.Item(0).GetDescription

   While Not Ovo.WaitUntilDone(0)
     WScript.Sleep 100
   Wend
End If

WScript.Echo "Done."
From a command, through Powershell one-liner see this HowTo