Have you ever noticed that if you include a variable within a PowerShell Write-Host statement, that variable is evaluated, even if you include the reference to the variable within the quotation marks?
Write-Hostコマンドレットを、Write-Errorコマンドレットに置き換えると、出力先がストリーム6からストリーム2に切り替わる ...
Business.com on MSN

Understanding functions in PowerShell

Don’t copy and paste the same code over and over again. Instead, create a PowerShell function and save yourself time.