Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

write-host is inserting leading spaces on variables

$
0
0

It seems like this would be a no brainer but I have to admit defeat.

$sIPAddress='192.168.1.152'

write-host '"HostName"="'$sIPAddress'"'

outputs

"HostName"=" 192.168.1.152"

I can't have the leading space. I tried $($sIPAddress) to no avail.

Bonus question, how do I select a plain text editor or a code block.

Thanks, sorry for all the blank lines...

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles