What is the best way to write output to a file rather then the terminal?
I have played around with set-content and add-content but neither of
them meet my needs. If i use set-content, then each new line that I
write to the file, overwrites the previous line, if I use add-content,
then each time I run the script, it appends it to the file if it already
exists. Is there a way I can create a handle to a file and specify once
what I plan to do with that file so that each time I run the script I
can be sure that I am not appending to a file that already exists unless
that is what I want to do?