다음을 통해 공유


Out-Printer

Sends output to a printer.

구문

Default (기본값)

Out-Printer
    [[-Name] <String>]
    [-InputObject <PSObject>]
    [<CommonParameters>]

Description

The Out-Printer cmdlet sends output to the default printer or to an alternate printer, if one is specified. Since the cmdlet doesn't have any way to configure the print job, the resulting print job uses the default settings defined for the printer.

Note

This cmdlet was reintroduced in PowerShell 7. This cmdlet is only available on Windows systems that support the Windows Desktop.

예제

Example 1 - Send a file to be printed on the default printer

This example shows how to print a file, even though Out-Printer does not have a Path parameter.

Get-Content -Path ./readme.txt | Out-Printer

Get-Contentgets the contents of the readme.txt file in the current directory and pipes it to Out-Printer, which sends it to the default printer.

Example 2: Print a string to a remote printer

This example prints Hello, World to the Prt-6B Color printer on Server01.

"Hello, World" | Out-Printer -Name "\\Server01\Prt-6B Color"

The Name parameter selects a specific printer, rather than the default.

Example 3 - Print a help topic to the default printer

This example prints the full version of the Help topic for Get-CimInstance.

$H = Get-Help -Full Get-CimInstance
Out-Printer -InputObject $H

Get-Help gets the full version of the Help topic for Get-CimInstance and stores it in the $H variable. The InputObject parameter passes the value of $H to Out-Printer.

매개 변수

-InputObject

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.

매개 변수 속성

형식:PSObject
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:True
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Name

Sends the output to the specified printer. The parameter name Name is optional.

매개 변수 속성

형식:String
Default value:None
와일드카드 지원:False
DontShow:False
별칭:PrinterName

매개 변수 집합

(All)
Position:0
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

입력

PSObject

You can pipe any object to this cmdlet.

출력

None

This cmdlet returns no output.

참고

Windows PowerShell includes the following aliases for Out-Printer:

  • lp

The cmdlets that contain the Out verb 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.

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