Reading between the lines from a couple of posts, I found that I can use $env:SystemDrive in place of %SystemDrive%
So I can do something like this:
Import-Module WebAdministration
$website = Get-Website | Where-Object {$_.name -eq 'SharePoint - 443'}
$logfileDirectory = $website.logFile.directory -replace '%SystemDrive%', $env:SystemDrive
...