This seems to work (except that it runs sleep.exe instead of ffmpeg.exe) :
[CODE lang="b4x" highlight="25,31"]Sub Button1_Click
Log("Click start")
Dim batchfile As List
batchfile.Initialize
batchfile.Add("@echo off")
batchfile.Add("break on")
batchfile.Add("")
batchfile.Add("e:")
batchfile.Add("cd \util")
batchfile.Add("echo before")
batchfile.Add("echo. | time")
batchfile.Add("start /low /min /affinity 1 /wait sleep 20")
batchfile.Add("echo. | time")
batchfile.Add("echo after")
File.WriteList(File.DirTemp, "custom.bat", batchfile)
Dim cmd As String = File.dirtemp & "\custom.bat"
cmd = cmd.Replace("\\", "\")
Log(cmd)
Sh.Initialize("ShellEvent", "cmd.exe", Array As String("/c", cmd)) ' Example command: dir
Sh.Run(-1) ' Run the command with no timeout (-1)
Log("Click done")
End Sub
Sub ShellEvent_ProcessCompleted(Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log("ProcessCompleted: " & Success & TAB & ExitCode)
Log(StdOut)
End Sub[/CODE]
[CODE lang="html" title="Log output" highlight="4,8,10"]Waiting for debugger to connect...
Program started.
Click start
C:\Users\emexe\AppData\Local\Temp\custom.bat
Click done
ProcessCompleted: true 0
before
The current time is: 1:27:12.47
Enter the new time:
The current time is: 1:27:32.73
Enter the new time:
after[/CODE]