Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Why use Join-Path - PowerShell

$
0
0

So here's a question I don't understand, why use Join-Path?  I see it all over the place, and it's heavily used by top competitors in the scripting games.  I also see people like Don Jones using the heck out of it.

What's the difference in using join-path vs. just connecting a string?

# is this somehow, better/bore reliable/more aesthetically pleasing

$path = "c:\reports"
$newpath = Join-path -path $path -childpath "$env:computername.html"

# Than this

$path = "c:\reports"
$newpath = "$path\$env:computername.html"
Both commands just return me a string value so I don't see any difference from that end.

Hope that helps! Jason



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>