Possible to automate insertion of header/footer to HTML file?

I’m not asking anyone to do this for me, but want to know if automating this task is possible with PS before i waste too much time trying. :slight_smile:

I’m not a windows guy at all, and would normally just write this in PHP, but the place i work is Windows only, and they need a replacement for an antiquated .net routine and none of the crack “development” staff will attempt this simple task:

Need to open a file from one folder, insert an HTML header and footer (i can find/replace a placeholder), then save the file to a new location.

I’ve already determined that i can watch the origin folder for new saves, and trigger the copying of the file to a new destination. If someone can tell me if it would be possible to insert a step to open the file, insert the header/footer, then save, i would appreciate it.

Thank you. As sick as this may sound, i’m actually looking forward to learning PowerShell :slight_smile:

Yes, you can achieve the same easily. You have to save the file content in a variable, then use replace method to replace defined place holder, finally save/output the variable in a file.

And also there are several ways to do it, the above mentioned way is not the ultimate option.

Do some research, write your code, if you stuck, post back to us :blush:.



Thank you for the prompt reply. Happy to learn that there are multiple ways to accomplish this. I’m on it!!!