Skip to content

Instantly share code, notes, and snippets.

@MateuszNad
Created January 31, 2020 21:20
Show Gist options
  • Select an option

  • Save MateuszNad/e176a1f620ff2cf6f3a87fa66f605236 to your computer and use it in GitHub Desktop.

Select an option

Save MateuszNad/e176a1f620ff2cf6f3a87fa66f605236 to your computer and use it in GitHub Desktop.
function Join-PathElement {
param(
[string[]]$Element
)
[array]$FullPath = $Element[0]
for ($i = 1; $i -lt $Element.Count; $i++) {
$FullPath += Join-Path -Path $FullPath -ChildPath $Element[$i]
}
$Id = $FullPath.Count - 1
Write-Output ($FullPath[$Id])
}
Describe 'Przyklad testu' {
It 'Sprawdzanie wyniku' {
Join-PathElement -Element 'C:\Users', 'Temp', 'file.txt' | Should -Be 'C:\Users\Temp\file.txt'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment