How to read a variable which is set within an executed batch file so I can verify it? (Vb.NET)
In your batch file, you can write the variable to a text file etc. This file can be added as an ActiveData asset in Workbench.
In your script you then load the ActiveData, pass the row value as a String and then use the Verify() method to verify if the value is correct.
Public Module Main
Dim _desktop As Desktop = Agent.Desktop
Public Sub Main()
'function to verify ActiveData value
Private Function VerifyVariable()
Dim data As ActiveData = Workbench.LoadActiveData("ReadBatchVar")
Dim row As ActiveDataRow = data.Item(1)
Dim batVal As String = row.GetString(1)
data.Dispose() '!Important - End loaded ActiveData
You will also have a separate .Net script called 'ExecuteBatch' which calls the following function to execute the Batch File.
'function to start process - batch file
Private Function ExecuteBatch()
Dim process As Process = Process.Start("C:\Temp\Batch.bat")
Attached is a sample project which demonstrates how this can be done in Workbench .Net Script. This includes the above .Net scripts and the ActiveData asset and .txt file. You will need to point the ActiveData asset in Workbench to wherever you have it stored the .txt file.