How to Use the clip Command in Windows to Pipe Command Prompt and PowerShell Output to the Clipboard

When working inside Windows Command Prompt or PowerShell, copying command output traditionally requires manually selecting text with the mouse, right-clicking the console window, or redirecting output to a temporary text file on disk. Windows includes a built-in utility called clip that redirects command-line output streams directly into the Windows Clipboard. Whether you need to paste system information into an IT support ticket, copy directory trees into an email, or export file hashes without leaving the terminal, clip streamlines command-line workflows.

How the clip Command Works in Windows

The clip tool operates as a standard output sink. By piping the standard output (stdout) of any Windows console command into clip, the text stream is captured in memory and immediately transferred to the Windows clipboard buffer:

command | clip

Once captured, the data is instantly accessible across any graphical application by pressing Ctrl + V or through the Windows Clipboard History panel (Win + V).

Copying Command Output Directly to Clipboard

You can pipe any standard command or utility into clip. Here are some of the most practical everyday examples:

Administrative Task Command Clipboard Result
Copy Current Directory Path cd | clip The exact active folder path is copied to clipboard as plain text.
Copy IP & Network Details ipconfig /all | clip Copies full IPv4/IPv6, gateway, DNS, and adapter configurations.
Copy Directory File Listing dir /b | clip Copies a clean list of bare filenames without dates or file size headers.
Copy Running Process List tasklist | clip Copies all active processes, PID numbers, and session memory usage.
Copy System Specifications systeminfo | clip Copies complete OS build, BIOS, processor, and hotfix audit data.

Copying Entire File Contents Without Opening an Editor

If you need to copy a configuration file, SSH public key, or software licence code directly to your clipboard without launching Notepad, use the input redirection operator (<):

clip < C:\Users\Username\.ssh\id_rsa.pub

The entire text content of the file is loaded directly into your clipboard ready for pasting into GitHub or server administration panels.

Using Modern PowerShell Clipboard Cmdlets

While the legacy clip.exe utility functions perfectly inside PowerShell, PowerShell 5.1 and PowerShell 7 introduce native clipboard cmdlets with enhanced data handling:

  • Set-Clipboard: Pushes strings, objects, or file collections into the clipboard.
    Get-Service | Where-Object Status -eq "Running" | Set-Clipboard
  • Get-Clipboard: Reads current clipboard text into PowerShell variables or pipeline commands.
    Get-Clipboard | Out-File -FilePath C:\Logs\PastedNotes.txt

Troubleshooting Line Breaks and Character Encoding

  • Terminal Hangs on Bare Execution: If you type clip by itself without piping data, the prompt will wait indefinitely for keyboard input. Type your text and press Ctrl + Z followed by Enter to commit, or press Ctrl + C to abort.
  • Unicode and Special Character Support: While clip.exe supports ANSI and standard ASCII characters, non-English Unicode characters may occasionally display as question marks when piped from Command Prompt. If handling UTF-8 files, use PowerShell’s Get-Content -Encoding UTF8 file.txt | Set-Clipboard to preserve diacritics and foreign character sets.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.