2 Replies - 455 Views - Last Post: 14 July 2017 - 06:53 PM

Using WriteAllText(): "\n" Newline Escape Sequence Does Nothin

Posted 11 July 2017 - 12:51 PM

Hey all,
I'm extremely frustrated here and just about @ my wits end with this one. I cannot figure out what I'm doing wrong here except that last time when I was writing to a file I was using the marshal strings library so maybe this has something to do with that. Anywhoo... here's what I'm working with:

So everytime that I try and add "\n" into my Strings^ it's now not working... />/>/>/>

I have no idea why.. last time I used this escape sequence a hundred times with the marshal strings and ofstream method of writing to file. Basically I'm trying to write another .ps1 file but for some reason when I write to the file and go into it there's no space[EDIT: NO NEW LINE, sorry I said space but mean no new line].

So when I click this button it's not a usable script because the set-executionpolicy unrestricted is mashed in with the copy-item code. Can anyone explain to me why the newline escape sequence isn't working, judging by that code? The whole thing compiles fine it's just as if there's no escape sequence. I've tried putting the "\n" all over the place in those String^s but no matter where it put it ... they never work. Wassupwidat? />/>/>/>