![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Formatting output with write-host Hello, I have a problem using write-host cmdlet. Here's the line that I'm using to display FQDN of a computer: write-host "Fully Qualified Domain Name: " $strCompName.ToLower() "." $strPrimaryDomain`n And I receive: Fully Qualified Domain Name: xp-comp . test.local I want to avoid space between computername, dot and a domain name. How can I achieve it? I realize that ampersand is not required to concatenate items in PS. Thanks a lot in advance. BR, Vedran |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Formatting output with write-host Try this write-host "Fully Qualified Domain Name: $($strCompName.ToLower()).$($strPrimaryDomain)" or write-host ("Fully Qualified Domain Name: {0}.{1}" -f $strCompName.ToLower(),$strPrimaryDomain) "Vedran Matica" <vedran.maticaREMOVE_THIS@xxxxxx-com.hr> wrote in message news:exOwiWk9HHA.980@xxxxxx Quote: > Hello, > > > I have a problem using write-host cmdlet. > Here's the line that I'm using to display FQDN of a computer: > > write-host "Fully Qualified Domain Name: " $strCompName.ToLower() "." > $strPrimaryDomain`n > > And I receive: > Fully Qualified Domain Name: xp-comp . test.local > > I want to avoid space between computername, dot and a domain name. > > How can I achieve it? I realize that ampersand is not required to > concatenate items in PS. > > Thanks a lot in advance. > > BR, > Vedran > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Formatting output with write-host Try: write-host "Fully Qualified Domain Name: $($strCompName.ToLower()).$strPrimaryDomain`n" -- Kiron |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Formatting output with write-host I have just realized that I can use -separator parameter with an empty string. :-) Quote: > Hello, > > > I have a problem using write-host cmdlet. > Here's the line that I'm using to display FQDN of a computer: > > write-host "Fully Qualified Domain Name: " $strCompName.ToLower() "." > $strPrimaryDomain`n > > And I receive: > Fully Qualified Domain Name: xp-comp . test.local > > I want to avoid space between computername, dot and a domain name. > > How can I achieve it? I realize that ampersand is not required to > concatenate items in PS. > > Thanks a lot in advance. > > BR, > Vedran > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Formatting output with write-host Guys, thanks. You have a really good response time. :-) And the best thing is that the same thing can be accomplished in various ways. Vedran |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Formatting output | PowerShell | |||
| Formatting output | PowerShell | |||
| formatting AD output | PowerShell | |||
| Formatting HTML output possible? | PowerShell | |||
| get-help output formatting bug | PowerShell | |||