script to instert text at the begining of every php file in a directory
Can you help me get started with writing a script that will insert text at the very top of ever php file in a directory? This is what I need.
<?php
if (!isset($_SESSION)){
session_start();
}
?>
Jeremy that script is similar to mine but I think the reason it does not work is because in this line "$content | Add-Content -path $_ " the $_ does not contain the path. It just conaitns the name of the file.
Get-ChildItem "C:\Backup1" -Filter *.php | Foreach-Object {
Add-Content -path $_ (Get-Content "C:\Scripts\code.txt")
}
Just trying to get it to work now.