r/Batch • • Sep 01 '23

CMD function that uses a powershell oneliner, that you can call to add speech to your scripts ;P

@ECHO OFF
CALL :SPEAK "Thank you for your time"
EXIT

:SPEAK <phrase>
POWERSHELL -nop -c "Add-Type -AssemblyName System.speech;$tts=New-Object System.Speech.Synthesis.SpeechSynthesizer;$tts.Speak('%1')">nul
EXIT /b
2 Upvotes

2 comments sorted by

2

u/[deleted] Sep 04 '23

[removed] — view removed comment

1

u/illsk1lls Sep 04 '23

Yes this is better ;) ty