title: Why don't .NET objects in PowerShell use the current directory?
body: <p>When you use a .NET object from PowerShell, and it takes a filename, it always seems to be relative to <code>C:\Windows\System32</code>.</p>
  
  <p>For example:</p>
  
  <pre><code>[IO.File]::WriteAllText('hello.txt', 'Hello World')
  </code></pre>
  
  <p>...will write <code>C:\Windows\System32\hello.txt</code>, rather than <code>C:\Current\Directory\hello.txt</code></p>
  
  <p>Why does PowerShell do this? Can this behaviour be changed? If it can't be changed, how do I work around it?</p>
  
  <p>I've tried <code>Resolve-Path</code>, but that only works with files that already exist, and it's far too verbose to be doing all the time.</p>