none
Simple PowerShell Question RRS feed

  • Question

  • In this code fragment -

    Get-ChildItem 'D:\Tools' -Directory |
       ForEach-Object{
        $path1="$($_.Fullname)\mypath\*.*"
        $path2=$_.Fullname + '\mypath\*.*'
        Write-Host $path1
        Write-Host $path2
       }

    what is the effect of "$( ) . . . ." when assigning a value to $path1? I do not understand the purpose of the surrounding double quotes nor of the lone $ character. The script line assigning a value to $path2 appears to generate the same result.

    Monday, January 12, 2015 11:28 PM

Answers