title: Run bat file in c# throws not recognized error
body: <p>I wan to add some DNS records in c# program via a bat file so I have written these lines in bat file:</p>
  
  <pre><code>    set servername=%1
  set siteaddress=%2
  
  
  "C:\Windows\System32\dnscmd.exe" %servername% /zoneadd %siteaddress% /primary /file  %siteaddress%.dns
  </code></pre>
  
  <p>and I have written these lines in C#:</p>
  
  <pre><code>Process p = new Process();
                      p.StartInfo.UseShellExecute = false;
                      p.StartInfo.WorkingDirectory = Application.StartupPath;
                      p.StartInfo.FileName = General.DnsBatPath;
                      p.StartInfo.Arguments = string.Format("{0} {1}", General.DnsServerName, txtSiteAddress.Text);
                      p.Start();
                      p.WaitForExit();
  </code></pre>
  
  <p>I get this error "dnscmd.exe is not recognized as internal or external command..." but when I run bat file manually (outside of C#) all things are OK.</p>
  
  <p>I changed my C# code to check what happened</p>
  
  <pre><code>Process.Start(@"C:\Windows\System32\dnscmd.exe");
  </code></pre>
  
  <p>I still get "not recognized ..." error.but I can see dnscmd.exe in "C:\Windows\System32".
  I changed my C# code again to check another thing:</p>
  
  <pre><code>Process.Start(@"C:\Windows\System32\cmd.exe");
  </code></pre>
  
  <p>and after that CMD windows will be opened???
  any idea?</p>