Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Out-Printer

Updated: October 17, 2013

Applies To: Windows PowerShell 4.0

Out-Printer

Sends output to a printer.

Aliases

The following abbreviations are aliases for this cmdlet:

  • lp

Syntax

Parameter Set: Default
Out-Printer [[-Name] <String> ] [-InputObject <PSObject> ] [ <CommonParameters>]




Detailed Description

The Out-Printer cmdlet sends output to the default printer or to an alternate printer, if one is specified.

Parameters

-InputObject<PSObject>

Specifies the objects to be sent to the printer. Enter a variable that contains the objects, or type a command or expression that gets the objects.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Name<String>

Specifies the alternate printer. The parameter name ("Name") is optional.


Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • System.Management.Automation.PSObject

    You can pipe any object to Out-Printer.


Outputs

The output type is the type of the objects that the cmdlet emits.

  • None

    Out-Printer does not return any objects.


Notes

  • You can also refer to Out-Printer by its built-in alias, "lp". For more information, see about_Aliases.

    The cmdlets that contain the Out verb (the Out cmdlets) do not format objects; they just render them and send them to the specified display destination. If you send an unformatted object to an Out cmdlet, the cmdlet sends it to a formatting cmdlet before rendering it.

    The Out cmdlets do not have parameters for names or file paths. To send data to an Out cmdlet, use a pipeline operator (|) to send the output of a Windows PowerShell command to the cmdlet. You can also store data in a variable and use the InputObject parameter to pass the data to the cmdlet. For more information, see the examples.

    Out-Printer sends data, but it does not emit any output objects. If you pipe the output of Out-Printer to Get-Member, Get-Member reports that no objects have been specified.

Examples

-------------------------- EXAMPLE 1 --------------------------

This command prints the content of the about_Signing Help topic to the default printer. This example shows you how to print a file, even though Out-Printer does not have a Path parameter.

The command uses the Get-Content cmdlet to get the contents of the Help topic. The path includes $pshome, a built-in variable that stores the installation directory for Windows PowerShell. A pipeline operator (|) passes the results to Out-Printer, which sends it to the default printer.


PS C:\> get-content $pshome\about_signing.help.txt | Out-Printer

-------------------------- EXAMPLE 2 --------------------------

This command prints "Hello, World" to the "Prt-6B Color" printer on Server01. This command uses the Name parameter to specify the alternate printer. Because the parameter name is optional, you can omit it.


PS C:\> "Hello, World" | out-printer -name "\\Server01\Prt-6B Color"

-------------------------- EXAMPLE 3 --------------------------

These commands print the full version of the Help topic for Get-WmiObject. The first command uses the Get-Help cmdlet to get the full version of the Help topic for Get-WmiObject and stores it in the $h variable. The second command sends the content to the default printer. It uses the InputObject parameter to pass the value of the $h variable to Out-Printer.


PS C:\> $h = get-help -full get-wmiobject
PS C:\>out-printer -inputobject $h

Related topics


Out-Default

Out-File

Out-Host

Out-Null

Out-String



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.