I have a service that I want to start a process to run another process.
My code is
Sub ExecuteProcess()
Try
Dim Msg As String = "Download Service has fired"
Dim RunJob As New System.Diagnostics.Process
RunJob.StartInfo.FileName = "Runjob.bat"
RunJob.StartInfo.Arguments = Msg
RunJob.StartInfo.CreateNoWindow = False
RunJob.Start()
Catch ex As Exception
Dim Event1 As New EventLog
Event1.Log = "Application"
Event1.Source = "DownLoad Service"
Event1.WriteEntry("Error in ExecuteProcess. : " & Chr(13)
& ex.ToString)
End Try
End Sub
This code works fine from a non service app. When I run it inside a
service app, I get no errors but it doesn't appear to run.
Is there a way to run in a service?
jwc
Jim Hughes - 06 Apr 2005 12:54 GMT
Where is Runjob.bat?
Try using a fully qualified path name.
Services have %windir%\system32 as the current directory
When you are running it with the standalone app, it is probaby in the same
directory as the executable.
>I have a service that I want to start a process to run another process.
>
[quoted text clipped - 24 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***
Jim Bob - 06 Apr 2005 17:33 GMT
RunJob.bat is in C:\Winnt\System32. It may just be me, but
I think it has more to do that it is running in a service. In a non
service, a cmd window pops up for the time the runjob.bat is executing.
In a service app, I see no cmd window.
jwc