Powershell 5 says "no way Jose", can't join path with null or empty string. I say why not? Is there a way to get join-path to be more "Flexible" without adding more if-else blocks?
$its_in_the_path = $true
#$its_in_the_path = $false
if ($its_in_the_path) {
$mydir = ""
}
else {
$mydir "C:\tool\path
}
$tool = join-path $mydir "runit.exe"
Cannot bind argument to parameter 'Path' because it is an empty string.
daskljdhgfaklsuhfalhfluwherfluqwhrluq2345214723452345h2kjrwefqy345
At + ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [frunsim], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,frunsim