Make your batch file speak

47 1 0
                                        

Personally, i believe batch is the most useful language as a beginner as it's universally accepted from vista to windows 10 and everything in between but it would be naive to believe that it's brother (powershell) doesn't provide a boost of power and potential to a bland and boring batch file. In this tutorial, i will be discussing a feature from my program Nova which uses a powershell program alongside batch to achieve this cool feature which could be used for infinite purposes.


Here we have the basic version of the Sapi command

Oops! This image does not follow our content guidelines. To continue publishing, please remove it or upload a different image.

Here we have the basic version of the Sapi command. This creates the object Sapi and uses it to speak anything within the ("").  Now as previously mentioned this is a basic version but there has been code made where in a certain time in the day, Sapi will say some unique dialogue that you have assigned which can be created by the following code below

  Now as previously mentioned this is a basic version but there has been code made where in a certain time in the day, Sapi will say some unique dialogue that you have assigned which can be created by the following code below

Oops! This image does not follow our content guidelines. To continue publishing, please remove it or upload a different image.

source - https://www.howtogeek.com/

As you can see, implementation of this code could be unique for your program and would mean folks are greeted to the voice of there computer differently in the morning and night, which brings me onto the last point

"How could you implement this shell program into batch?"

Well good question, it's rather simple actually. Just put the shell program in the same folder as your batch program and then use the 'start' command followed by the title of your shell program and then vbs as this is what you have to save the file as at the end. Which would look like this

start talk.vbs

Hopefully this has sparked ideas for you as well as expanded your own batch programs in new exciting ways. Stay safe



Batch File ProgrammingWhere stories live. Discover now