My purpose is to write some string into a file, and the file path is something like %SystemDrive%\temp.txt
. The pipeline looks like
Write-Output "test" | Out-File -FilePath %SystemDrive%\temp.txt
I can get %SystemDrive%
by (Get-ChildItem -Path Env:\SystemDrive).Value
, but how can I put it into the pipeline?