calling exe from a .net windows service

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matt Nunnally
    New Member
    • Jul 2007
    • 56

    calling exe from a .net windows service

    I've created a windows service which implements a timer. On the timer elapsed event, I'm trying to invoke another exe. The exe runs several procedures quickly (in about 10-15 seconds) and then exits on its own. The service seems to be launching that application just fine, but it doesn't seem to get through all of the procedures. If i launch that exe on its own, it works fine.

    Here is the code I use to launch it:

    Code:
        Private Sub TimerElapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
    
            Dim startinfo As System.Diagnostics.ProcessStartInfo
            Dim pstart As New System.Diagnostics.Process
    
            startinfo = New System.Diagnostics.ProcessStartInfo("C:\Program Files\ActivationBatchService\ABS.exe")
            pstart.StartInfo = startinfo
            pstart.Start()
            pstart.WaitForExit()
    
        End Sub
    Any ideas?
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    Originally posted by Matt Nunnally
    I've created a windows service which implements a timer. On the timer elapsed event, I'm trying to invoke another exe. The exe runs several procedures quickly (in about 10-15 seconds) and then exits on its own. The service seems to be launching that application just fine, but it doesn't seem to get through all of the procedures. If i launch that exe on its own, it works fine.

    Here is the code I use to launch it:

    Code:
        Private Sub TimerElapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
    
            Dim startinfo As System.Diagnostics.ProcessStartInfo
            Dim pstart As New System.Diagnostics.Process
    
            startinfo = New System.Diagnostics.ProcessStartInfo("C:\Program Files\ActivationBatchService\ABS.exe")
            pstart.StartInfo = startinfo
            pstart.Start()
            pstart.WaitForExit()
    
        End Sub
    Any ideas?
    Instead of starting the process is there a method you can call that will let you run a dos command? You can then run your exe like you would in the command prompt.

    Comment

    Working...