How do I concatenate strings with variables in PowerShell?

Viewed 101645

I'm trying to build a file path in PowerShell and the string concatenation seems to be a little funky.

I have a list of folders:

c:\code\MyProj1
c:\code\MyProj2

I want to get the path to a DLL file here:

c:\code\MyProj1\bin\debug\MyProj1.dll
c:\code\MyProj2\bin\debug\MyProj2.dll

Here's what I'm trying to do:

$buildconfig = "Debug"

Get-ChildItem c:\code | % {
    Write-Host $_.FullName + "\" + $buildconfig + "\" + $_ + ".dll"
}

This doesn't work. How can I fix it?

4 Answers
Related