If you work in Windows and are comfortable using the console, sooner or later you'll want to send documents to the printer without opening any graphical applications. Print from CMD or PowerShell It's fast, scriptable, and perfect for automating tasks. from day to day, from sending a TXT to dumping the output of a command directly to paper.
In this guide I explain, with a practical approach, the two main ways: the PowerShell Out-Printer cmdlet and the PRINT command of the Symbol of the system. You will also see how to prepare files, filter content, avoid typical errors and chain commands to control what you print down to the last detail. All with syntax, examples, and important nuances you'll want to know.
Options for printing in Windows from the console
In Windows, you have two complementary options. On the one hand, PowerShell offers the Out-Printer cmdlet to send the output of a command or object to the printer (either the default or a specific one). It is direct, works by pipeline and inherits the default printer settings, without exposing formatting controls on the cmdlet itself.
On the other hand, the Command Prompt (CMD) maintains the classic PRINT command for texts, with the option to choose a device. It is a veteran utility focused on text files, useful when you don't need the full power of PowerShell or are working with batch scripts.
One key nuance: Out-Printer exists only on Windows (not macOS or Linux). If you use PowerShell on other platforms, this cmdlet is not available., so you will have to look for alternatives specific to that environment, such as Print from terminal in Linux.
In both cases, if you do not specify a printer, the system default will be used. When you need to point to a network printer, you can specify its UNC name. with Out-Printer and, in CMD, the corresponding device in PRINT.
Out-Printer in detail: syntax, parameters and behavior
This is the skeleton of the cmdlet so you have the reference handy. Note the optional parameters Name and InputObject and supports the usual PowerShell CommonParameters.
Out-Printer <String>]
Short description of behavior: Out-Printer sends output to the default printer or another printer if you specify it. It offers no formatting options or print job controls.; the default values of the selected printer are used.
- Consumer Relations Platform:Windows.
- Format: Cmdlets with the Out verb do not format; they render and output to a presentation destination.
- Channeled output: emits no objects. If you pipe its output to Get-Member, you'll see there's nothing to examine.
Main Parameters: They are few and simple, which makes them quicker to use. in scripts and in interactive console.
- -Name (alias: PrinterName). Type: String, Position: 0, Optional. Indicates the destination printer.
- -InputObject. Type: PSObject. Accepts piped values, optional. This is the object sent to the printer.
- CommonParameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, -WarningVariable.
Inputs and outputs: You can pipe any PSObject as input, and the cmdlet returns nothing (OutputType: None). This makes it ideal as an endpoint for a pipeline.
Operational Notes: When Out-Printer receives a raw object, PowerShell will automatically insert a formatting cmdlet before rendering it. This ensures that what reaches the printer has a textual representation., even if you do not specify the format manually.
Practical examples with Out-Printer
Printing a file to the default printer even if Out-Printer doesn't have -Path is very straightforward: just read the file and pipe it.
Get-Content -Path ./readme.txt | Out-Printer
In this pattern, Get-Content extracts the content and Out-Printer sends it to the default printer. Use it for TXT, logs or outputs that are already plain text.
Printing a string to a remote (UNC) printer allows you to quickly test connectivity and print spooling. It is ideal for verifying that the printer's shared name is correct..
"Hello, World" | Out-Printer -Name "\\Server01\Prt-6B Color"
If you want to print the full help for a cmdlet, you can dump the contents of Get-Help and send it as an object. The key is to use -InputObject with the previously retrieved value.
$H = Get-Help -Full Get-CimInstance
Out-Printer -InputObject $H
Remember that Out-Printer does not control printing options (pages, tray, duplex, etc.). The printer's default values will always be applied., so any fine-tuning will have to be done on the device or with specific tools other than the cmdlet.
Print from the Command Prompt with PRINT
The PRINT command is native to Windows 10/11 and modern Windows Server editions. Its purpose is simple: print text files from CMD.
PRINT archivo ]
The /D option specifies the printing device. If you do not specify it, the default printer will be used.It's a perfect utility if your workflow is still batch-based and you work with pure TXT.
A basic example sending a .txt to the default device would be as simple as: Open CMD where the file is and run PRINT name.txtIf you're using a mapped printer or a specific device name, append it with /D.
Prepare and select what to print with file cmdlets
Before printing, it's a good idea to decide which files will be queued, move them to a temporary folder, or filter by criteria. PowerShell shines here with file system cmdlets.
Listing contents with Get-ChildItem (aliases: gci, dir, ls) and showing hidden or system files is immediate with -Force. Add -Recurse if you want to drill down into subfolders.
Get-ChildItem -Path C:\ -Force
Get-ChildItem -Path C:\ -Force -Recurse
If you're looking for more sophisticated filtering, combine gci with Where-Object to base your filter on properties like date and size. This pattern is ideal for generating printable inventory lists..
Get-ChildItem -Path $env:ProgramFiles -Recurse -Include *.exe |
Where-Object { ($_.LastWriteTime -gt '2005-10-01') -and ($_.Length -ge 1mb) -and ($_.Length -le 10mb) }
Copying or versioning work files is a breeze with Copy-Item, and you can check for prior existence with Test-Path. Use -Force to overwrite read-only targets.
if (Test-Path -Path $PROFILE) {
Copy-Item -Path $PROFILE -Destination $($PROFILE -replace 'ps1$', 'bak') -Force
}
To prepare print folder structures, create empty directories and files with New-Item. Differentiate between -ItemType Directory and -ItemType File depending on your needs..
New-Item -Path 'C:\temp\Nueva Carpeta' -ItemType Directory
New-Item -Path 'C:\temp\Nueva Carpeta\listado.txt' -ItemType File
If you need to clean up intermediate folders, Remove-Item deletes files or directories. When there is content and you want to avoid confirmations, add -Recurse.
Remove-Item -Path C:\temp\ColaTemporal -Recurse
You can even map a folder as a temporary logical drive with New-PSDrive to shorten paths during the process. With -Persist only remote paths are supported and integrated into the Explorer.
New-PSDrive -Name P -Root $env:ProgramFiles -PSProvider FileSystem
Read, write, and combine texts before printing
Get-Content reads text files as an array (each line is an element). This makes it very convenient to preview, filter or transform before printing..
$lineas = Get-Content -Path .\listado.txt
$lineas.Length
For generating content on the fly, Write-Output (aka: write, echo) and redirection are your allies. Redirect with > to create/overwrite and with >> to append.
Write-Output "Encabezado del informe" > informe.txt
Write-Output "Nueva línea" >> informe.txt
If you want to clone content, you can use Get-Content with redirection instead of Copy-Item. It works well with patterns and wildcards when you are consolidating texts..
Get-Content benjamin.txt > benjamin2.txt
Get-Content *.log > combinado.log
Beware of a classic: redirecting Get-Content *.txt to a file that also ends in .txt in the same directory can create an “endless” loop because the destination file becomes the source. You abort with Control-C, but prevention is better.
Get-Content *.txt > gran.txt # Riesgo: gran.txt coincide con *.txt
The clean solution is to exclude the target file with the -Exclude parameter. This way you avoid your own result entering the input set..
Get-Content *.txt -Exclude gran.txt > gran.txt
Use wildcards to your advantage to select exactly what you need (e.g., ben*.txt). A well-tuned selection reduces surprises and speeds up your flow..
Quick search and count before sending to the printer
To locate specific fragments in multiple files, Select-String (alias: sls) is like having grep built into PowerShell. Perfect for validating that the text to be printed contains what you expect..
Select-String "existencia única" *.txt
And if you need quick metrics, pipe to Measure-Object (measure) to count lines, words, and characters. Add -IgnoreWhiteSpace if you want to discount spaces.
Get-Content benjamin.txt | Measure-Object -Line -Word -Character
Get-Content *.txt | Measure-Object -Line -Word -Character -IgnoreWhiteSpace
This pre-check saves paper and time, especially in large batches. Measure, check, then print with Out-Printer or PRINT with the peace of mind that what comes out of the printer is exactly what you need.
Typical workflows for printing from the console
Scenario 1: Print a TXT generated by a process. Read, check a few lines and send to the default printer.
Get-Content .\resultado.txt -TotalCount 10
Get-Content .\resultado.txt | Out-Printer
Scenario 2: Send a label or header to a shared printer. Ideal for testing or network printers.
"Etiqueta: Pedido 12345" | Out-Printer -Name "\\SrvPrint\HP-Laser"
Scenario 3: Consolidate several logs of the day and then print. Avoid the output loop with -Exclude and filter by date pattern if necessary.
Get-Content .\logs\*.2025-09-*.log -Exclude resumen.log > resumen.log
Get-Content resumen.log | Out-Printer
Scenario 4 (CMD): Quickly print a TXT from a script batch. Useful when PowerShell is not part of the flow (see open prn files).
PRINT /D:PRN01 C:\reportes\hoy.txt
Related navigation and productivity tips
To move between folders: Set-Location (sl, cd) and tab completion save you typing and errors. You can combine relative paths like ..\.. to jump branches.
If you switch between two locations a lot, Push-Location (pushd) and Pop-Location (popd) are very convenient: You save the current location to the stack and return with a single command..
Would you rather see something in Explorer? Launch explorer . from the current folder. This way you can visually verify what you are going to print from the console..
Renaming or moving files with Move-Item (mv) and copying them with Copy-Item (cp) is lightning fast. Be careful when using rm (Remove-Item): it permanently deletes items., it doesn't go to the trash.
If you're working with lists (e.g., hosts or IP addresses) in a TXT file, Get-Content returns an array; you can use this as a basis for generating a report and sending it to Out-Printer. Pipelining turns these flows into concise, repeatable steps..
Built-in help and useful parameters
Get-Help shows you the syntax and parameters of any cmdlet. If you add -Online, it will open detailed help in the browser.It is the fastest way to clarify specific doubts.
Get-Help Out-Printer
Get-Help Get-Content -Online
In the case of Get-Content, -TotalCount lets you read only the first X lines and -Tail the last X. They are perfect for checking a piece before printing. and avoid surprises on paper.
Get-Content .\informe.txt -TotalCount 10
Get-Content .\informe.txt -Tail 10
You've already seen that -Exclude is key to preventing the destination file from becoming the source during a consolidation. Keep this in mind when working with wildcards. and redirects.
Limitations, warnings and good practices
Out-Printer has no controls for format, margins or trays; accepts the printer's default settings. If you need more control, look for manufacturer-specific tools or generate a PDF with the desired format and then print it (for example, Print as PDF in Windows 11).
Out-Printer does not output to the pipeline, by design. Don't try to chain its result to Get-Member: There will be no object to examine. Use this as the final step in the pipeline.
If you are printing large volumes of text, check the size and number of lines with Measure-Object first. A 5-second check can save many pages and ink.
When using PRINT in CMD, remember its focus on text files. For non-text content, PowerShell and Out-Printer offer more flexible rendering. thanks to the pipeline and the prior conversion of objects to text.
And if something is “thinking” too long (for example, a loop due to a poorly planned redirection), interrupt it with Control-C and review the commands. Avoid using the same input pattern as the output file name in the same directory.
This walkthrough will leave you ready to print from the console with ease: you'll be familiar with Out-Printer and PRINT, you'll know how to prepare and filter files, measure content, search for strings, and avoid pitfalls like redirection loops. With these parts you can assemble robust, repeatable and fast flows that send exactly what you want, to the printer you want, without depending on the graphical interface.
Passionate writer about the world of bytes and technology in general. I love sharing my knowledge through writing, and that's what I'll do on this blog, show you all the most interesting things about gadgets, software, hardware, tech trends, and more. My goal is to help you navigate the digital world in a simple and entertaining way.


