[System.IO.Path]::Combine not taking my powershell variable as a parameter?

Question:

Why isn’t the function [System.IO.Path]::Combine taking my first parameter?

The third command shows that only the second and third parameters were concatenated or is it using an empty string as $g_basePath..?

Answer:

Just omit the leading backslash on your second path:


A pure PowerShell attempt would be to use the Join-path cmdlet twice:

Source:

[System.IO.Path]::Combine not taking my powershell variable as a parameter? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply