title: Open Powershell from cmd and use filter - problem with escaping?
body: <p>I am starting several powershell instances from a batch script.</p>
  <p>With one, I'd like to tail a file and add a timestamp to each line. The command itself works well in powershell directly:</p>
  <p><code>filter timestamp {&quot;$(Get-Date -Format G): $_&quot;}; Get-Content .\MyLog.txt -tail 10 -wait | Select-String 'Search term' | timestamp</code></p>
  <p>But when I use the following command within cmd, I get errors:</p>
  <p><code>start powershell -Command &quot;filter timestamp {&quot;$(Get-Date -Format G): $_&quot;}; Get-Content .\MyLog.txt -tail 10 -wait | Select-String 'Search term' | timestamp&quot;; pause</code></p>
  <p><a href="https://i.stack.imgur.com/FSuNX.png" rel="nofollow noreferrer">Example for an error</a>:</p>
  <pre><code>In Zeile:1 Zeichen:18
  + start powershell -Command &quot;filter timestamp {&quot;$(Get-Date -Format G):  ...
  +                  ~~~~~~~~
      + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
      + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand 
  </code></pre>
  <p>I wonder if I need to escape? Have tried many options but after hours I need some pro help.</p>
  <p>Thanks a lot.</p>