title: Remove trailing backslash from msbuild batching Directory property
body: <p>I'm trying to get an exec task inside an msbuild script to work and have found a very annoying issue. The exec command is sweet except that the process I'm running (Ncover.Console.exe) can't handle a backslash at the end of a directory name.</p>
  
  <p>To illustrate with a snipped example, the following works:  </p>
  
  <pre><code>&lt;exec command="NCover.Console.exe nunit-console.exe some.dll [snip] //w c:\out" /&gt;
  </code></pre>
  
  <p>But this fails (note the slash at the end of "c:\out"):  </p>
  
  <pre><code>&lt;exec command="NCover.Console.exe nunit-console.exe some.dll [snip] //w c:\out\" /&gt;
  </code></pre>
  
  <p>The reason I can't simply delete the trailing backslash is that the value is read using batching. So in the same snipped as above, it <em>actually</em> looks like this:  </p>
  
  <pre><code>&lt;exec command="NCover.Console.exe nunit-console.exe some.dll [snip] //w 
  &amp;quot;%(TestAssemblies.RootDir)%(TestAssemblies.Directory)&amp;quot; /&gt;
  </code></pre>
  
  <p>So my question is how can I remove this pesky trailing backslash?</p>
  
  <p>Thanks in advance.</p>