title: How to write to the console in PowerShell?
body: <p>I am having a little confusion about the various ways to print (echo) to the console. I have seen that there are multiple ways to write output to the console, such as:</p>
  
  <pre><code>Write-Host "Hello world1"
  "Hello World2"
  Out-Host -InputObject "Hello World3"
  </code></pre>
  
  <p>All three ways will print to the console. The middle one is somehow simpler and less verbose and easier to use. I also find that when you write a function such as:</p>
  
  <pre><code>function GetValues()
  {
      "1"
      "2"
  }
  </code></pre>
  
  <p>It still returns two strings in the pipeline:</p>
  
  <p>And I'm still able to print out the values:</p>
  
  <pre><code>foreach ($s in GetValues)
  {
      Write-Host "s: " $s
  }
  </code></pre>
  
  <p>The thing that I have found was that using just the quoted string doesn't always appear on custom hosts, and that I have had to use <a href="http://technet.microsoft.com/en-us/library/hh849877.aspx">Write-Host</a> to get values to print on custom hosts.</p>
  
  <p>Somehow I find this confusing. Is <code>"Print something"</code> supposed to be an alias to <code>Write-Host</code> or what is the intent?</p>