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