id like to format the output of CSV Records in a specific way.
Lets say, i have a csv file with these records:
Field1,Field2
blah,blah
bluh,bluh
Now, what i want to achieve is an output (into console or file) with this format
('blah','blah')
('bluh','bluh')
This [1] does not work! Powershell simply writes nothing into out.txt.
[1]
Import-Csv .\test.csv | Select-Object Field1,Field2 | ForEach-Object {Write-Host "('"$_.Field1"', '"$_.Field2"')"} > .\out.txt
Write-Hostyou should useWrite-Outputif you intend the text to be output.