title: Run multiple lines of PowerShell script in CMD
body: <p>I'm trying to the following powershell script in cmd. Here's a trivial example:</p>
  
  <pre class="lang-cs prettyprint-override"><code>$path = "c:\"
  cd $path
  ls
  </code></pre>
  
  <p>Some PowerShell script of multiple lines and with quotation marks.</p>
  
  <p>I read <a href="https://stackoverflow.com/questions/41910267/executing-inline-powershell-script">this post</a> and @Alex's answer in <a href="https://stackoverflow.com/questions/3235850/how-to-enter-a-multi-line-command/3235993">this post</a>, but putting multiple lines together with <code>;</code> between them didn't work:</p>
  
  <pre>
  C:\Users\abcd>powershell "&c:\ ; ls"
  & : The term 'c:\' is not recognized as the name of a cmdlet, function,
  script file, or operable program. Check the spelling of the name, or if
  a path was included, verify that the path is correct and try again.
  At line:1 char:2
  + &c:\ ; ls
  +  ~~~
      + CategoryInfo          : ObjectNotFound: (c:\:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
  </pre>
  
  <hr>
  
  <p>PS: My actual task is to run the following (I provided the trivial task above, since not everyone has the database).</p>
  
  <pre><code>$tabular_server = "abc_123\Tabular"
  
  [Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
  $server = New-Object Microsoft.AnalysisServices.Server
  $server.connect($tabular_server)
  $db = $server.Databases.Item("db_name")
  
  $db.Process("ProcessClear")
  $db.Process("ProcessDefault")
  $server.Disconnect()
  </code></pre>