Echo in Windows Powershell

Sharky Forums


Results 1 to 2 of 2

Thread: Echo in Windows Powershell

  1. #1
    Expensive Sushi
    Join Date
    Sep 2007
    Posts
    7

    Echo in Windows Powershell

    I am trying to learn Windows Powershell so forgive if this sounds stupid. Basically I'm trying to count how many installed printers I have and then print it out on the screen with the output something like

    There are 5 printers installed.

    The code I am using is:

    $count=Get-WmiObject Win32_Printer
    echo 'There are' $count 'printers installed.'

    But it prints it in this way:

    There are
    5
    printers installed.

    How can I get it to print on one line?

  2. #2
    Expensive Sushi
    Join Date
    Sep 2007
    Posts
    7
    Never mind.. I figured it out. Use Write-Host instead of echo. Cheers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •