Hi Peter,
This looks interesting,
I did not know if I was allowed to assiign to $_.
what about using -replace ?
could you tell me how to do the same only using -replace instead of [regex]::replace ?
Eyal
B.T.W I will only be able to check if it solves my use case tomorrow when I go to work.
Main Topics
Browse All Topics





by: peter_fieldPosted on 2009-11-06 at 16:18:33ID: 25764267
ForEach-Object will output whatever would normally be returned on the pipeline.
i.e.
echo "abc" | foreach-object { $t = $_ }
would return nothing, because assigning a variable doesn't normally return anything. To make it return something, you would have to do something like:
echo "abc" | foreach-object { $t = $_ ; $t }
Have a look at the two samples below and see if they help you at all - if you want me to adopt this for your use case, provide some more detail of what you are trying to do.
Select allOpen in new window