0

I read everywhere (i.e. Redirect Write-Host statements to file) that Write-Host cannot be redirected to file. But

Given t.ps1 file:

function Log(){
    Write-Host "host msg"
}

Log

I see "host msg" in file:

PS D:\> & ./t.ps1 *>> .\out.log

PS D:\> gc .\out.log
host msg
smg
  • 1,096
  • 2
  • 11
  • 27

1 Answers1

0

I guess you can Write-output instead of write-host, to redirect output to a file or use pipe and out-file cmdlet.

DKU
  • 77
  • 1
  • 7