title: C# - Executing external exectutable with arguments
body: <p>I have been trying to convert my python code to c# code. For some reason, the c# code gets to the DirectoryInfo declaration and says the path is not found. If someone can tell me why, it would be appreciated.</p>
  
  <p>This is the original python code:</p>
  
  <pre><code>def encode(path, dest):
       for root_dir, dirs, files in os.walk(path, topdown=False):
  
          for name in files:
              (base, ext)=os.path.splitext(name)
              input_file = os.path.join(root_dir,name)
              output_file = os.path.join(dest_dir, base+".mkv")
              if (os.path.exists(output_file)):
                   print ("skipped")
              else:
                   subprocess.call( ["HandBrakeCLI.exe", "-i", input_file, "-o", output_file, "-e", "x264", "--aencoder", "ac3", "-s", "1", "--subtitle-default", "1" ])
  </code></pre>
  
  <p>This is my current c# code:</p>
  
  <pre><code>string qpath = Path.GetFullPath((Environment.CurrentDirectory + "\\Queue\\"));
  if (Directory.Exists(Path.GetFullPath(qpath)))
  {
      var DirMKV = (Directory.GetFiles(qpath, "*.*", SearchOption.AllDirectories).Where(s =&gt; s.EndsWith(".mkv") || s.EndsWith(".mp4")).ToArray());
      foreach (string file in DirMKV)
      {
          DirectoryInfo dirinfo = new DirectoryInfo(file);
          if (dirinfo.Parent.Parent.ToString().Contains("S"))
          {
              string ipath = Environment.CurrentDirectory;
              string dpath = ipath + @"\Queue\" + dirinfo.Parent.Parent.ToString() + @"\" + Path.GetFileName(file);
              string opath = ipath + @"\Finished\" + dirinfo.Parent.Parent.ToString() + @"\" + Path.GetFileName(file);
              string arg = "-i " +dpath + " -o " +opath +" -e  x264 "+ " --aencoder ac3 "+ "-s 1 "+ "--subtitle-default 1";
              if (!File.Exists(opath))
              {
                  Process.Start(ipath + @"\handbrakeCLI.exe", arg);
              }  
          }
      }
  }
  </code></pre>