Join-Path
Build a path safely
Join-Path -Path .\docs -ChildPath 'notes.txt'
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Join-Path
Joins path parts and gets the separators right. Prefer this over string concatenation.
Try this
Join-Path -Path $env:TEMP -ChildPath 'demo.log'