For $_ , to make a difference, you must use it in the context where it is actually installed. For your specific scenario, this means that you need to pass your svn call to the ForEach-Object :
dir * -include *.cs | Select-String -simplematch -pattern "HeadURL$" | select filename | % { svn propset svn:keywords "HeadURL Id LastChangedBy LastChangedRevision" $_ }
(I used the alias % for short)
Inside ForEach variable $_ is relevant and can be used.
However, I saw some uses when the current pipeline object was added to the program arguments when connecting to non-cmdlets. I have not figured this out yet.
But to understand what you are doing here: you are trying to install svn:keywords on each file that uses one of them. Probably a more robust and readable approach would be to actually filter the list you are viewing:
gci * -inc *.cs | Where-Object { (Get-Content $_) -match 'HeadURL$' }
(may work, not tested)
Then you can continue by simply laying this in foreach:
| ForEach-Object { svn ps svn:keywords "HeadURL Id LastChangedBy LastChangedRevision" $_.FullName }
In addition, here you can access all the properties of the file object and you do not need to rely on the Select-String object.
source share