title: Naming a Process so i can kill it later on
body: <p>I have a Process I start off that will ping a host repeatedly using:</p>
  
  <pre><code>ping my_ip /t
  </code></pre>
  
  <p>I use this code to start it</p>
  
  <pre><code>Process process = new Process();
  process.StartInfo = new ProcessStartInfo(@"C:\windows\system32\cmd.exe");
  process.StartInfo.UseShellExecute = false; 
  process.StartInfo.RedirectStandardOutput = true;
  process.StartInfo.RedirectStandardError = true;
  process.StartInfo.CreateNoWindow = true;
  process.StartInfo.Arguments = "/c ping " + my_ip  + " /t";
  process.Start();
  </code></pre>
  
  <p>Now, if my app is terminated unexpectedly i would like to close this 'PING' on restarting the app.</p>
  
  <p>I could enumerate through the processes until I see the name 'ping' and kill it.</p>
  
  <p>But being a pessimistic programmer there might be another Ping process started by another app so I would not want to kill that process.</p>
  
  <p>is there a way to set the id of a process so that I can kill that process specifically?</p>
  
  <p>i  am using C#</p>