title: How to escape pipe character from PowerShell command line to pass into non-PowerShell command
body: <p>I'm in a PowerShell console session, trying to run a Gradle script that exists in the <code>cwd</code> from the PowerShell command line.</p>
  
  <p>The Gradle command accepts an argument which includes quotes that can contain one or more pipe characters, and I can't for the life of me figure out how to get PowerShell to escape it using just one line (or any number of lines, actually - but I'm not interested in multi-line solutions).</p>
  
  <p>Here's the command:</p>
  
  <pre><code>./gradlew theTask -PmyProperty="thisThing|thatThing|theOtherThing"
  </code></pre>
  
  <p>...which produces this error:</p>
  
  <pre><code>'thatThing' is not recognized as an internal or external command, operable program or batch file.
  </code></pre>
  
  <p>I've tried all of these variants, none of which work. Any idea?</p>
  
  <pre><code>./gradlew theTask -PmyProperty="thisThing`|thatThing`|theOtherThing"
  ./gradlew theTask -PmyProperty=@"thisThing|thatThing|theOtherThing"
  ./gradlew theTask -PmyProperty="thisThing\|thatThing\|theOtherThing"
  ./gradlew theTask -PmyProperty="thisThing\\|thatThing\\|theOtherThing"
  ./gradlew theTask -PmyProperty="thisThing^|thatThing^|theOtherThing"
  </code></pre>