Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

writing text files compatible with notepad

$
0
0

I want to be able to write a file in powershell that can be opened in notepad (and sent as exchange email content).

the powershell defaults create a file which notepad doesn't exactly understand.

for example: write "`nline1`nline2`nline3" >test.txt

this should write 3 lines to test.txt, but if opened in notepad it comes out as 1 line.

if I open it with wordpad, it shows up as 3 lines.

if I use a command prompt and type 'echo.>test.txt' and then use powershell to append to the file, it works properly. that leads me to believe it has something to do with the format of the file. I have tried using various forms of out-file to create different encodings, but that doesn't seem to work.

any suggestions?

 

thanks,

Ole Jensen

 


Viewing all articles
Browse latest Browse all 10624

Latest Images

Trending Articles



Latest Images