This topic contains 2 replies, has 2 voices, and was last updated by
July 30, 2019 at 3:39 am #168370ParticipantTopics: 1Replies: 1Points: 21Rank: Member
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. 🙂
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 🙂
July 30, 2019 at 5:23 am #168469ParticipantTopics: 20Replies: 32Points: 160Rank: Participant
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 😊.
July 30, 2019 at 12:51 pm #168514ParticipantTopics: 1Replies: 1Points: 21Rank: Member
Thank you for the prompt reply. Happy to learn that there are multiple ways to accomplish this. I'm on it!!!
You must be logged in to reply to this topic.