On May 4, 8:47*am, "Vadims Podans [MVP]" <vpodans> wrote:
> just put all string in double quotes, without separating each part in
> quotes:
> write-host -foregroundcolor green "The email address of $DisplayName ($firm)
> is $PrimarySmtpAddress"
> --
> WBR, Vadims Podans
> MVP: PowerShell
> PowerShell blog -www.sysadmins.lv
>
> "Minniti Sergio" <MinnitiSer...@xxxxxx> rakstīja ziņojumā
> "news:B98019B7-827E-4B63-B439-F4350053F44E@xxxxxx"...
>
>
>
> > Hi,
> > From my powershell script I would like output a text string concatenates
> > with some text contained in a *$variable with no space before and after
> > the
> > $variable.
> > Example:
> > The email address of Rossi Mario (Acme) is mario.ro...@xxxxxx
> > In my powershell script I have witten:
> > write-host -foregroundcolor green "The email address of" $DisplayName
> > "("$firm") is" $PrimarySmtpAddress
> > but the output is
> > The email address of Rossi Mario ( Acme) is mario.ro...@xxxxxx
> > I don't *want the space between ( and Acme.
> > How can I do?
> > I have written some text lines like:
> > $text1 = "The email address of"
> > $text2 = "("
> > $text3 = ")"
> > $text4 = "is"
> > #write-host -foregroundcolor green $text1 $DisplayName $text2$firm$text3
> > $text4 $PrimarySmtpAddress
> > but I don't think that it is correct.
> > Have you any idea? I'll wait your reply, thanks! Some other options:
($text1 + $DisplayName + ' ' + $text2 + $firm + $text3)
[string]::join('', ($text1, ' ', $DisplayName, $text2, $firm, $text3))
'The email address of {0}({1})' -f $DisplayName, $firm