Question Run a .job file ?

nomaam

Member
Joined
Jul 4, 2004
Messages
12
Programming Experience
Beginner
Hello:

I have a .job file and am wanting to execute it through VB.Net and then determine when the process is completed.

I have the following .job task run path:


"C:\path\program.exe" "C:\path\properties.xml" -l"C:\path\program.log" -s"C:\path\session.xml"


I have the following code to execute an application and wait for its completion:


VB.NET:
Expand Collapse Copy
        Dim objProcess As System.Diagnostics.Process
        Try
            objProcess = New System.Diagnostics.Process()
            objProcess.StartInfo.FileName = ProcessPath
            objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
            objProcess.Start()

            'Wait until the process passes back an exit code
            objProcess.WaitForExit()

            'Free resources associated with this process
            objProcess.Close()
        Catch
            MessageBox.Show("Could not start process " & ProcessPath, "Error")
        End Try



The problem is that the .job run task is not just a single .exe program to execute. It has flags and other paths to process.

How would it be possible to execute a .job file from VB.Net and determine when it has completed?

Thanks.
 
Last edited by a moderator:
Perhaps you could try declaring your object WithEvents and using the Exit event of your object:

VB.NET:
Expand Collapse Copy
Private WithEvents objProcess As System.Diagnostics.Proces

    Private Sub objProcess_complete(ByVal sender As System.Object, ByVal e As EventArgs) Handles objProcess.Exited
        ' Do something here
    End Sub

Hope this helps
 
Back
Top