I have a script which outputs a text file based on a series of variables - the header, the content of a powershell script, some additional code and then a footer at the bottom all concatenated together. The file it outputs is basically the same PowerShell
script with an additional bit of code in it, two lines added at the beginning and some at the end with the existing script in the middle.
Everything works okay but it doesn't retain the formatting when it's outputted - everything ends up on one line and it's supposed to be a PowerShell script so it all ends up commented out.
I imagine I'm doing something wrong or at least there's a better way of doing it. I'm using get-content to grab the lot in one go because I didn't think that'd affect it but would doing it a different way affect the formatting?
Thanks