Join-Path
noun
say it: “JOYN path” /ˈdʒɔɪn pæθ/
A PowerShell command that builds a path from its parts, with the right separator between them.
What does Join-Path do?
Join-Path glues a path together from its parts, with the separator the system uses between them, so the same script works on Windows, a Mac and Linux. Windows PowerShell 5.1 takes only two parts.
Join-Path $env:LOCALAPPDATA 'RecipeBox' 'recipes.json'
# C:\Users\Sam\AppData\Local\RecipeBox\recipes.json
In a sentence
- “Join-Path built the path to recipes.json inside AppData.”
- “Sam uses Join-Path so the script works on a Mac too.”
Level: Apprentice · More PowerShell terms at this level
Updated