Hi
I am using a window service for job processing. This window service in turn calls other exe for Processing. How can i pass arguments between one window service and exe file.
And also i need to implement scheduled service in windows service. How can i implement scheduling and passing arg to exe file in window service?
Thanks
Loading
Prasad GodbolePosted Nov 20, 2012, 2:03 AM
Please try below code in the windows service to pass argument to the EXE through Windows service.
If you want to schedule Windows service then try for Winodws Scheduler (It comes with OS) instead of Windows service.
CODE
=========================
Dim myProcess As Process = Nothing
Try
myProcess = Process.Start("EXE path", "pass arguments here")
myProcess.WaitForExit()
Catch ex As Exception
If Not myProcess Is Nothing Then
myProcess.Close()
End If
Finally
If Not myProcess Is Nothing Then
myProcess.Close()
End If
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("Name of EXE")
If Not pProcess Is Nothing Then
If pProcess.Length > 0 Then
For Each p As Process In pProcess
p.Kill()
Next
End If
End If
End Try