I'm using the string expansion feature to build filenames, and I don't quite understand what's going on.
consider:
$baseName = "base"
[int]$count = 1
$ext = ".ext"
$fileName = "$baseName$count$Ext"
#filename evaluates to "base1.ext" -- expected
#now the weird part -- watch for the underscore:
$fileName = "$baseName_$count$Ext"
#filename evaluates to "1.ext" -- the basename got dropped, what gives?
Just adding the underscore seems to completely throw off Powershell's groove! It's probably some weird syntax rule, but I would like to understand the rule. Can anyone help me out?