Author Posts

February 11, 2017 at 7:15 pm

Hi All,

Need a little help with something I've been thinking about for sometime.

May sound silly but will be of great help to me.

February 12, 2017 at 10:33 am

Can you elaborate more on what you mean?
Do you mean save an entire script?
Or save the output?
Or something else?

February 12, 2017 at 10:48 am

Hi Joe,

Not sure why your example and additional text has disappeared but based on what I've in my notification from this forum. I think using a "here"-string would be the easiest option.


$FolderPath = "C:\Log\Test 1"
$Source = "D:\Log"

$script = @"
MD $folderPath
xcopy `"$Source`" `"$FolderPath`"

$script | Out-File -FilePath C:\temp\script.ps1