title: how to make batch file handle spaces in file names
body: <p>I have the following batch file to make <code>git diff</code> invoke spreadsheet compare UI in windows. So I'm trying to pass the git diff's 2nd (old file) and 5th (new file) arguments to spreadsheet compare in order to make it compare the file using git diff. </p>
  
  <p>So now, this batch file only successfully handles files with NO spaces in the file names, it CANNOT handle files with spaces in the file names. </p>
  
  <p>What code should I add to this script to make this batch code handles file with spaces: </p>
  
  <pre><code>@ECHO OFF
  set path2=%5
  set path2=%path2:/=\%
  ECHO %2 &gt; tmp.txt
  dir %path2% /B /S &gt;&gt; tmp.txt
  
  C:/"Program Files"/"Microsoft Office"/root/vfs/ProgramFilesX86/"Microsoft Office"/Office16/DCF/SPREADSHEETCOMPARE.EXE tmp.txt
  </code></pre>
  
  <p>It currently throw errors like this:</p>
  
  <blockquote>
  <pre><code>Unhandled Exception: System.ArgumentException: Illegal characters in path.
     at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
     at System.IO.Path.GetFileName(String path)
     at ProdianceExcelCompare.Form1.StatusReady()
     at ProdianceExcelCompare.Form1.Init()
     at ProdianceExcelCompare.Form1..ctor(String instructionFile)
     at ProdianceExcelCompare.Program.Main(String[] args)
  fatal: external diff died, stopping at London comparison.xlsx
  </code></pre>
  </blockquote>