IVR Tutorial Lesson 4: Run Windows Batch File

In order to avoid making outbound calls while the incoming call is still active, we need to delay the launch of the BroadcastByPhone program. Here, we'll use a Windows batch file to accomplish this task.

Windows batch files, also called batch programs or scripts, can simplify routine or repetitive tasks. A batch file is an unformatted text file that contains one or more commands and has a .bat or .cmd file name extension. When you type the file name at the command prompt, cmd.exe runs the commands sequentially as they appear in the file. For more information, please search the topic online or Microsoft's website.

Prepare the Batch File

The following batch file launches BroadcastByPhone program after a 30 second delay. Use the Windows Notepad program to enter the following lines, and then save it as runvcast.bat under the folder C:\Call List.

REM delays for 30 seconds

REM uses ping command as a workaround because there is no sleep command

ping -n 30 -w 1000 > NUL

REM now launches BroadcastByPhone

REM adds -noexit if you want to keep the program up after broadcast

C:\Program Files\Voicent\BroadcastByPhone\bin\vcast.exe C:\Call List\mylist.voc -startnow -cleanstatus -wavfile %1

The line REM starts with is comments. The %1 refers to the first argument when the batch file is invoked.

Run the Batch File

You can run the batch file from windows command window, or select the Windows Start button, select Run..., then type in the following commands:

C:\Call List\runvcast.bat

C:\Program Files\Voicent\MyRecordings\sample_message.wav

This batch file will first wait for 30 seconds and then launch the BroadcastByPhone program. The sample message is used for the broadcast. In the IVR sample, we'll pass the recorded audio file as the batch file argument.