Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2005

Tip: Looking for answers? Try searching our database.

Running a process from a Windows Service App

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim Bob - 05 Apr 2005 20:36 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.