title: You must provide a value expression following the '-' operator
body: <p>I have a some code in PowerShell and I need to use it in cmd.exe</p>
  
  <p>I am using this command in cmd.exe</p>
  
  <pre><code>powershell -command "command"
  </code></pre>
  
  <p>But it gives me this error</p>
  
  <pre class="lang-none prettyprint-override"><code>At line:1 char:72
  + ... nt D:\15.txt -TotalCount 3)[-1] | Foreach-object {$_ -replace REG_SZ, ...
  +                                                                  ~
  You must provide a value expression following the '-replace' operator.
  At line:1 char:73
  + ... 5.txt -TotalCount 3)[-1] | Foreach-object {$_ -replace REG_SZ,  } | F ...
  +                                                            ~~~~~~
  Unexpected token 'REG_SZ' in expression or statement.
  At line:1 char:79
  + ... .txt -TotalCount 3)[-1] | Foreach-object {$_ -replace REG_SZ,  } | Fo ...
  +                                                                 ~
  Missing argument in parameter list.
  At line:1 char:113
  + ... -object {$_ -replace REG_SZ,  } | Foreach-object {$_ -replace Gmail,  ...
  +                                                                  ~
  You must provide a value expression following the '-replace' operator.
  At line:1 char:114
  + ... t {$_ -replace REG_SZ,  } | Foreach-object {$_ -replace Gmail,  } | s ...
  +                                                             ~~~~~
  Unexpected token 'Gmail' in expression or statement.
  At line:1 char:119
  + ...  {$_ -replace REG_SZ,  } | Foreach-object {$_ -replace Gmail,  } | se ...
  +                                                                 ~
  Missing argument in parameter list.
      + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
      + FullyQualifiedErrorId : ExpectedValueExpression
  </code></pre>
  
  <p>My command is :</p>
  
  <pre><code>powershell -command "(Get-Content D:\15.txt -TotalCount 3)[-1] | Foreach-object {$_ -replace "REG_SZ", " "} | Foreach-object {$_ -replace "Gmail", " "} | set-content D:\15.txt"
  </code></pre>