Following the thread here I am trying to write to an output file in PowerShell 7.2:
# [String] $csvFile = "output.csv"
[String] $csvFile = ".\output.csv"
$stream = New-Object IO.StreamWriter $csvFile, $true
$stream.WriteLine("Some, text")
$stream.Close()
The file is not created. Also, if I create the file beforehand, the script does not write to it. What am I missing? I can get it to work with Out-File
but the streams are large and I prefer the Net approach.
Is it a permissions issue in the shell?