Weird Issue, unless i'm overlooking it?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
SIMMS7400
Posts: 546
Joined: 07 Jan 2016 07:47

Weird Issue, unless i'm overlooking it?

#1 Post by SIMMS7400 » 04 Apr 2020 07:55

Hi Folks -

I have a simple routine that sends an email via PowerShell. However, I ONLY want to redirect if and error occurs. However, when I use this syntax, it's still creating a blank file:

Code: Select all

POWERSHELL -ExecutionPolicy ByPass -file "Email_Utility.ps1" ^
	"%EMAIL_SERVERzz%" ^
	"%EMAIL_FROM%" ^
	"%EMAIL_FDMEE_DL%" ^
	"%EMAIL_PSSWD%" ^
	"%EMAIL_PORT%" 2>"emailerr.log"
	
pause	
Is there a way ONLY to produce a file on a true error?

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

Re: Weird Issue, unless i'm overlooking it?

#2 Post by ShadowThief » 04 Apr 2020 09:45

Is there a line in Email_Utility.ps1 to create a file?

Post Reply