title: Powershell command to trim path if it ends with "\"
body: <p>I need to trim path if it ends with <code>\</code>.</p>
  
  <pre><code>C:\Ravi\
  </code></pre>
  
  <p>I need to change to </p>
  
  <pre><code>C:\Ravi
  </code></pre>
  
  <p>I have a case where path will not end with <code>\</code> (Then it must skip).</p>
  
  <p>I tried with <code>.EndsWith("\")</code>, but it fails when I have <code>\\</code> instead of <code>\</code>. </p>
  
  <p>Can this be done in PowerShell without resorting to conditionals?</p>