title: Getting Missing expression after '=' error in powershell build step
body: <p>I am working on a team city build step. This is a powershell step in which I am using %teamcity.build.branch% and %teamcity.build.checkoutDirectory% parameters. Here is the script:</p>
  
  <pre><code>param([string]$branchName=%teamcity.build.branch%, [string]$bldCheckOutDir=%teamcity.build.checkoutDir%)
  
  write "Value of branchName is $branchName"
  write "Value of bldCheckOutDir is $bldCheckOutDir"
  
  if ($branchName.Substring(0,1) -like "F") {Write "Working on a Feature Branch"; CD $bldCheckOutDir\DCD-GUI; npm test; sonar-scanner -X}
  elseif ($branchName.Substring(0,2) -like "US") {Write "Working on a Story Branch"}
  elseif ($branchName.Substring(0,2) -like "DE") {Write "Working on a Defect Branch"}
  elseif ($branchName.Substring(0,2) -like "QA") {Write "Working on a QA1 Branch"; CD $bldCheckOutDir\DCD-GUI; npm test; CD ..; FortifyBatchFile.bat; sonar-scanner -X; }
  else {Write "BranchName not known"}
  </code></pre>
  
  <p>When I run this script as a build step in a build configuration, I get below error:</p>
  
  <blockquote>
    <p>[Step 4/4] Working directory: E:\BuildAgent\work\d429bf6e9117eae6
    [04:25:58][Step 4/4] PowerShell arguments: [-NonInteractive,
    -ExecutionPolicy, ByPass, -File, E:\BuildAgent\temp\buildTmp\powershell6621137048056018482.ps1]
    [04:26:08][Step 4/4] Missing expression after '='. [04:26:08][Step
    4/4] At
    E:\BuildAgent\temp\buildTmp\powershell6621137048056018482.ps1:1
    char:27 [04:26:08][Step 4/4] + param([string]$branchName= &lt;&lt;&lt;&lt; qa1,
    [string]$bldCheckOutDir=E:\BuildAgent\wo [04:26:08][Step 4/4]
    rk\d429bf6e9117eae6) [04:26:08][Step 4/4]     + CategoryInfo<br>
    : ParserError: (=:String) [], ParentContainsErrorR  [04:26:08][Step
    4/4]    ecordException [04:26:08][Step 4/4]     +
    FullyQualifiedErrorId : MissingExpressionAfterToken</p>
  </blockquote>
  
  <p>What am I doing wrong here?</p>