I\'ve been looking online for a specific answer to better help me understand how this works. In PHP we use the \" . \" to concatenate strings. However in powershell I see things
Powershell has very good help files included that can answer many questions.
See:
get-help about_operators
and you will find that the dot is used as both a Property dereferencing operator and a scope operator, with explanations of the use of each.
Can also see this under about_operators on TechNet
It's the member access operator. $_
is a special variable (the loop variable in this case). Therefore, $_.extension
accesses or invokes the property extension
on $_
.
DIR
command is similar to Get-ChildItem
command. The |
is similar to foreach
statement. The $_
sign indicates each element in foreach
loop. In your case, the code should get all which have .txt
extension from some location and then rename each of those elements due to { $_.name –replace “.“,”-” }
rule