Powershell Scripting Games - Day 3

This is my solution for Beginner Event 3

Here we have to parse a file and split it into two and rename the original file

# Read the input file
$InputFile = ".\Shot Put.txt"
#Get the content of the file
$Content = Get-Content $InputFile
#create the two files
$outfile1 = ".\Shot Put A.txt"
$outfile2 = ".\Shot Put B.txt"
#We now parse the file and divide it
    if ($line -match "^\\s\*$") #We have reached the end of a paragraph
        foreach ($line in $Content) 
            {$outfile = $outfile2} 
            {$line >> $outfile1} #The rest we put into the first file
#Rename the file 
Rename-Item -path '.\Shot Put.txt' -newname '.\Shot Put.old'