|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Multiple instances of executables?Multiple instances of executables?
I want to schedule task in "Schedule tasks" that starts an app (build in vb.net 2005) every 5 minutes. Every time the app starts i want to check if this job with the same task name, task name is passed as an argument to the app at start, is completed. If its not completed, just quit. Schedule tasks: ========== myApp.exe "TaskNameOne" myApp.exe "TaskNameTwo" myApp.exe "TaskNameThree" How can i check if the "taskname" is already running? Diagnostics.Process.GetCurrentProcess.StartInfo is empty. Thanks in advance! Hello,
Diagnostics.Process.GetCurrentProcess.StartInfo only have value when we set it: ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe"); startInfo.WindowStyle = ProcessWindowStyle.Minimized; Process.Start(startInfo); startInfo.Arguments = "www.northwindtraders.com"; Process.Start(startInfo); To get the arguments from command line, we nee to change the main() function in in program.cs: [STAThread] static void Main() { ... } to [STAThread] static void Main(string [] args) { ... } After get the arguments here, I suggest you may record them in a Text file on local disk, and delete the record when the applicaiton is quiting. when a new instance is running, it can first check the text file to see if the same argument has been recorded. Luke |
|||||||||||||||||||||||