From bb18c3436d8af273ed1eb9f5747e4145086fa1a9 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Thu, 5 Oct 2023 13:39:07 -0400 Subject: [PATCH] added note for Write-Output func --- Tools.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tools.ps1 b/Tools.ps1 index cc8a130..6df9f3d 100644 --- a/Tools.ps1 +++ b/Tools.ps1 @@ -54,6 +54,9 @@ Function Setup-LogFile { } # Log a message to the log file +# IMPORTANT: In Powershell 'echo' is an alias for Write-Output, which is overriden when this Tools.ps1 file is called before your script. +# To prevent unwanted behavior, if you need to echo something do the following instead: +# Start-Process "cmd.exe" -ArgumentList '/C echo y | some-command' Function Write-Output { param([Parameter(Mandatory=$true,ValueFromPipeline=$true)][string]$Message) $Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"