title: Write git logs to text file when called from a batch file
body: <p>I have a handful of repositories (maybe 15 or 20), most with several hundred commits. I would like to be able to call a batch file that has git write a log of each to a text file so I can parse them (once I have the separate files, I believe I can do easily, and plan to use C# most likely).  </p>
  
  <p>I know I can use git-bash in separate commands to do something like:  </p>
  
  <pre><code>cd "&lt;path to my repo&gt;"
  git --no-pager log &gt; log.txt
  </code></pre>
  
  <p>This gets me the files I want, but how can this be accomplished in a batch file?<br>
  Can I use git-bash in this way? Do I have to use git.exe instead?  </p>
  
  <p>If it's not a good idea to do this via a batch file, is it possible to do this in C# with Process.Start?  </p>
  
  <p>Some of the questions I've focused on so far:<br>
  <a href="https://stackoverflow.com/questions/10330425/how-do-i-export-a-git-log-to-a-text-file">How do I export a git log to a text file?</a> (how I leaned to use git-bash to create a text log)<br>
  <a href="https://stackoverflow.com/questions/26167387/run-git-commands-from-a-c-sharp-function">Run git commands from a C# function</a><br>
  <a href="https://stackoverflow.com/questions/28487132/running-bash-commands-from-c-sharp">Running Bash Commands from C#</a>  </p>
  
  <p>But I'm still not sure how to call what I want on each of the individual repositories. Especially in a batch file, where to my limited knowledge, each line is a standalone command (eliminating git-bash.exe as a possibility?).  </p>
  
  <p><strong>Update</strong></p>
  
  <p>I've tried using the below code:</p>
  
  <pre><code>public void RunGitForLogs()
  {
      Process process = new Process();
  
      ProcessStartInfo processStartInfo = new ProcessStartInfo();
      processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
      processStartInfo.FileName = @"C:\Program Files\Git\bin\git.exe";
      processStartInfo.WorkingDirectory = @"E:\git\myRepo";
      processStartInfo.Arguments = @"log --no-pager &gt; C:\users\me\desktop\log.txt";
      processStartInfo.RedirectStandardOutput = true;
      processStartInfo.RedirectStandardError = true;
      processStartInfo.UseShellExecute = false;
  
      process.StartInfo = processStartInfo;
      process.Start();
  
      var outStd = new List&lt;string&gt;();
      var outErr = new List&lt;string&gt;();
  
      //https://stackoverflow.com/a/16276776/2957232
      while (process.StandardOutput.Peek() &gt; -1)
          outStd .Add(process.StandardOutput.ReadLine());
  
      while (process.StandardError.Peek() &gt; -1)
          outErr .Add(process.StandardError.ReadLine());
  
      process.WaitForExit();
  }  
  </code></pre>
  
  <p>But in outErr I get the following lines:</p>
  
  <blockquote>
    <p>fatal: ambiguous argument '>': unknown revision or path not in the working tree.<br>
        Use '--' to separate paths from revisions, like this:<br>
        'git [...] -- [...]'</p>
  </blockquote>
  
  <p>Using "status" as an argument works as expected for this repo (Many lines in outStd, nothing in outErr).</p>