Hi
I'm trying to put together a console app that kills off an existing process and then reloads it, and then closes the console window (would prefer the console window to be invisable if thats poss?).
My code is:
It seems to launch my app, but doesnt seem to close the instance in the first place. Can anyone point out where I am going wrong please? Also, any pointers in adding a small time delay in closing and relaunching the .exe?
Thanks in advance
I'm trying to put together a console app that kills off an existing process and then reloads it, and then closes the console window (would prefer the console window to be invisable if thats poss?).
My code is:
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace Demo_Console
{
class Program
{
public void Kill(program.exe);
static void Main(string[] args)
{
Process ExternalProcess = new Process();
ExternalProcess.StartInfo.FileName = "C:\\folder\\program.exe";
ExternalProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
ExternalProcess.Start();
ExternalProcess.WaitForExit();
public bool CloseMainWindow ();
}
}
}
It seems to launch my app, but doesnt seem to close the instance in the first place. Can anyone point out where I am going wrong please? Also, any pointers in adding a small time delay in closing and relaunching the .exe?
Thanks in advance
Last edited by a moderator: