title: PowerShell mkdir alias + Set-StrictMode -Version 2. Strange bug. Why?
body: <p>It's something unbelievable. This is a PowerShell code snippet in <code>test.ps1</code> file:</p>
  
  <pre><code>Set-StrictMode -Version 2
  mkdir c:\tmp\1  # same with 'md c:\tmp\1'
  </code></pre>
  
  <p>Start <code>cmd.exe</code>, navigate to folder with <code>test.ps1</code> script and run it:</p>
  
  <pre><code>c:\tmp&gt;powershell ".\test.ps1"
  </code></pre>
  
  <p>This produces the following error:</p>
  
  <pre><code>The variable '$_' cannot be retrieved because it has not been set.
  At line:50 char:38
  +         $steppablePipeline.Process($_ &lt;&lt;&lt;&lt; )
      + CategoryInfo          : InvalidOperation: (_:Token) [], ParentContainsEr
     rorRecordException
      + FullyQualifiedErrorId : VariableIsUndefined
  </code></pre>
  
  <p>Why?</p>
  
  <p>It works when started from PowerShell console but not cmd.exe. I discovered this bug in much larger script. It was a WTF moment.</p>
  
  <p>What is wrong with this simple script?</p>