hi all,

so stuck on this and trying to figure out why

echo $fn" "$ln
robert wild
PS C:\Users\robert.wild.admin.PROD> $mailfl = $fn" "$ln
ParserError:
Line |
   1 |  $mailfl = $fn" "$ln
     |               ~~~
     | Unexpected token '" "' in expression or statement.

so doing a echo works but when i try to make it a variable it says bad token

thanks,
rob

5 Spice ups

[quote=“robert k wild, post:1, topic:1203522, username:robertkwild”]
$mailfl = $fn" "$ln
[/
if that is powershell it should be
$mailfl = $fn + " " + $ln
It looks like powershell except for the echo statements.

4 Spice ups

$mailfl = $fn + " " + $ln
or
$mailfl = "$fn $ln" (this is close to yours but you have quotes in the wrong place)

4 Spice ups

echo is an alias for Write-Output. There’s a lot of “DOS” aliases in PowerShell (which is super handy for old farts like me).
Get-Alias (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Learn

1 Spice up

there are LOL. but it makes it less clear with limited context sometimes.

2 Spice ups

Right now Jeffrey Snover is feeling the urge to face palm and isn’t sure why. :slight_smile:

I believe his preferred method would be

$mailfl = ‘{0} {1}’ -F $fn, $ln

I consider that the least readable of all of them, but a lot of people frown on addition in strings.