Windows copy to clipboard command line

Does anyone know if it's possible to copy text from a Windows' command prompt or console window like the output of a command, console application or batch file?

Does anyone know if it’s possible to copy text from a Windows’ command prompt or console window like the output of a command, console application or batch file?

Mofi's user avatar

Mofi

44.7k16 gold badges77 silver badges137 bronze badges

asked Jul 18, 2012 at 14:23

user1508893's user avatar

user1508893user1508893

8,94314 gold badges44 silver badges56 bronze badges

0

Another option, if you know ahead of time that you want the results of a command to be placed on the clipboard, is to pipe your output to the CLIP utility.

Here are a two simple examples

echo Hello world!|clip

dir|clip

answered Jul 18, 2012 at 16:50

dbenham's user avatar

2

  • Right click > Mark
  • Select the text you want to copy by holding left mouse button and selecting text OR by navigating to the beginning of the text you want to copy with the arrow keys, pressing Shift, and moving (with the arrow keys) to the end of the text.
  • right click on the title bar, go into «Edit», and hit Copy.

Now you can paste in Notepad or in Command Prompt again by right-clicking on the title bar, going into «Edit», and hitting «Paste.»

answered Jul 18, 2012 at 14:35

arthur.e.anderson's user avatar

2

Open a command window, then right click on the title bar and left click on Properties at bottom of context menu. On the Options tab add a check-mark at QuickEdit Mode. Click OK and in the next dialog select the second radio button so that every command window that you will open in future has got this option enabled. Close the dialog with OK.

Now you can select text using left click on your mouse. To copy the text to the clipboard, just press the Enter key.

Mofi's user avatar

Mofi

44.7k16 gold badges77 silver badges137 bronze badges

answered Jul 18, 2012 at 21:20

8bit's user avatar

0

Follow these steps:

  1. Move pointer with pointing device (mouse, touchpad, pointing stick, …) over the window, press right button to open the context menu and left click on first context menu option Mark.
  2. After that action select the text with holding left button (rectangular selection).
  3. After selecting hit key Enter or Return to copy selected text to clipboard.
  4. Paste copied text anywhere with Ctrl+V.

Mofi's user avatar

Mofi

44.7k16 gold badges77 silver badges137 bronze badges

answered Mar 16, 2017 at 10:40

Sunil's user avatar

SunilSunil

3,6271 gold badge31 silver badges43 bronze badges

  • Right Click > Mark
  • Select the text you want to copy with left click held
  • Right click on the selected text
  • Paste where you want

answered Jul 18, 2012 at 14:24

assylias's user avatar

assyliasassylias

317k78 gold badges656 silver badges772 bronze badges

Sure you can! right-click, choose mark, select the needed text and right click again to copy the text.

You could also choose QuickEdit mode from the cmd menu, that way you don’t have to right click and select mark, but can select copy directly.

answered Jul 18, 2012 at 14:25

Kuf's user avatar

KufKuf

17k6 gold badges65 silver badges89 bronze badges

Haloo my friend :
if you want to copy any text which was currently in the clipboard in
the Cmd or in the PowerShell you should Just :

1 Write any command that you want .

2before pressing enter write |clip and then press Enter .

3Open any text Editor such as Notepad .

4 Ctrl+v or Right click -Paste .

and her you have the clipboard in your Text Editor ^_^ .

answered Mar 30, 2017 at 23:09

Zain Abo Samra's user avatar

On PowerShell:

Copy contents in a text file to the clipboard. Use

cat filename.txt | clip

the contents will be copied to the clipboard.

Now, it’s ready to ctrl + v

answered Apr 5, 2022 at 6:22

Elstargo's user avatar

1

If you right click and mark in the context menu you can then drag to edit the selection and then press Ctrl+c and it should copy to the clipboard

answered Jul 18, 2012 at 14:26

redrah's user avatar

redrahredrah

1,19210 silver badges20 bronze badges

1

Select the text you want to copy.
Then right click and select copy from menu.
To paste in cmd right click, the text you copied should be pasted

answered Aug 9, 2022 at 11:17

F B I's user avatar

F B IF B I

112 bronze badges

Is there any way to copy text that’s shown in the Command Prompt window C:Windowssystem32cmd.exe to the clipboard?

asked Jun 10, 2011 at 8:35

Pacerier's user avatar

PacerierPacerier

26.2k81 gold badges194 silver badges270 bronze badges

3

Right click on the title bar and go to edit menu
All the options you need are there (copy, paste, select)

or To change the option to allow quick editing

Right click on the title bar and go to properties > quickedit mode enable.
Now you don’t need to go through the edit menu to select or copy or paste.

Enter short cut to copy
Right click short cut to paste
Left click drag to select text.

Every thing is put into a the system clip board so crtl + v will work in to other applications like notepad.

QuickEditMode

Bob Stein's user avatar

Bob Stein

1,3371 gold badge16 silver badges23 bronze badges

answered Jun 10, 2011 at 8:43

nelaaro's user avatar

nelaaronelaaro

12.6k30 gold badges81 silver badges110 bronze badges

6

You need to right click and select Mark

You can then highlight the rectangle of text you want to copy.

Then hit Return to copy it into the clipboard.

answered Jun 10, 2011 at 8:44

ChrisF's user avatar

ChrisFChrisF

41.1k17 gold badges97 silver badges152 bronze badges

1

  1. Enter marking mode: Alt+Space,E,K
    (yes, these are just the hotkeys for the process described in nelaar’s answer).

  2. Move the cursor with the arrow keys to the start of your selection (the selection is rectangular).

  3. Hold Shift to select text while using the arrow keys to expand your selection.

  4. Press Enter to copy the selection to the clipboard.

Community's user avatar

answered Jun 12, 2012 at 14:48

Oliver Salzburg's user avatar

Oliver SalzburgOliver Salzburg

85.3k61 gold badges258 silver badges306 bronze badges

1

  1. Right click and and select mark
    mark

  2. Block the text that you want to copy (by hold Shift key + bottom , top, right, or left)
    block the text

  3. Press «ENTER»

  4. Paste it into notepad or other (MS. Word, Etc.).

answered Jun 12, 2012 at 19:57

TOFIK's user avatar

TOFIKTOFIK

1222 silver badges12 bronze badges

2

Windows Command-line tools are great for troubleshooting, as well as automation. But, if you’re stumped when a tech support guy on the phone asks you to run a built-in console command and copy the output displayed for diagnosing a problem, these Command Prompt basics will come in handy.

This post explains how to copy or redirect Command Prompt output to a file or the clipboard.

Table of Contents

  • Open a Command Prompt window
  • Copy Command Prompt output to Clipboard
    • Using keyboard shortcuts
    • Using the Edit menu
    • Piping the output to Clip (Clip.exe tool)
  • Redirect Command-line output to a file
    • Redirecting the output to a new file
    • Redirecting the output to a file (append contents)
  • Take a Screenshot

Opening a Command Prompt window

To open a Command Prompt window, press WinKey + R to launch the Run dialog. Type in cmd.exe and press Ok. In Windows 8.1 and Windows 10, you can right-click Start and click Command Prompt. There are several other ways to open Command Prompt.

Command Prompt window

If the console tool you’re running or the operation you’re performing requires administrative privileges, you need to open Command Prompt as administrator (also known as “elevated” Command Prompt.)

In the Command Prompt window, type in the command you want to run. For example, someone who’s helping you wants to know your system information by running SystemInfo command, type systeminfo and press ENTER.

copy command prompt output

Copying the output to clipboard

To copy the command prompt output to the clipboard, use one of the methods.

Using Keyboard: Press Ctrl + A to select all text, and press ENTER to copy it to the clipboard.

Using the Edit menu: Right-click the Command Prompt title bar → EditSelect All. Repeat the same, and this time, select Copy from the Edit menu.

copy command prompt output

Using Clip.exe console tool: The Clip.exe console tool is built-in to Windows, starting with Windows Vista and up to Windows 10. This tool copies the data redirected or passed to it, into the clipboard. You can redirect the output of your console tool or command to the clipboard using the built-in Clip.exe tool by piping the output. The command you’d run is:

systeminfo |clip

That would copy the output of the systeminfo command to the Windows Clipboard. This is done by Clip.exe receiving the command-line output directly.

Once the output is sent to the clipboard, you can paste it into a text editor. For example, you can open Notepad and paste (Ctrl + V) the contents there.

copy command prompt output

Redirecting the output to a new file

You can redirect the command-line output to a file instead of Clipboard. This method can be useful if the output is too lengthy, containing several hundreds of lines that can easily exceed the Command Prompt window’s screen buffer size. To output the results to a file, use this syntax/examples:

systeminfo >%temp%systeminfo.txt

That would create a file named systeminfo.txt in the user’s Temp folder. To write the output to a file on your desktop, you’d use:

systeminfo >%userprofile%desktopsysteminfo.txt

Redirecting the output to a file by appending

The previous command would create a new file or erase the previous file (if one exists with the same name). If you want to append the command-line output to a file, use double greater-than symbols >>, as below:

ipconfig >>%userprofile%desktopsysteminfo.txt
systeminfo >>%userprofile%desktopsysteminfo.txt

That would output the contents of Ipconfig and Systeminfo commands to the same file. If a file exists with the same name systeminfo.txt, it would be used. Otherwise, a new file would be created.

Another example

ipconfig >%userprofile%desktopinfo.txt
sc query wuauserv >>%userprofile%desktopinfo.txt
dir d:tools*.exe >>%userprofile%desktopinfo.txt
dir C:WindowsSystem32Tasks /s /b >>%userprofile%desktopinfo.txt

Command Prompt window

The first command would create a new file (as a single > symbol is used) named info.txt. Subsequent commands would output the results to the existing info.txt file (double >> symbol).

Take a Screenshot

In some cases, you may not require the text output, and a screenshot is sufficient. Win + PrntScrn keystroke is used to take a screenshot quickly in Windows 8 and 10. Or use the excellent built-in Snipping Tool. Check out How to Take a Screenshot in Windows for a detailed guide.

I hope this guide helped you learn how to copy or redirect Command Prompt output to a file or the clipboard.


One small request: If you liked this post, please share this?

One «tiny» share from you would seriously help a lot with the growth of this blog.
Some great suggestions:

  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!

So thank you so much for your support. It won’t take more than 10 seconds of your time. The share buttons are right below. :)


If you’re doing work at the command line on your Windows box, it’s sometimes useful to copy the output of a command to the clipboard, but who wants to try and scroll and click to use copy and paste? Here’s how to do it the easy way.

Note: For the purposes of our exercise, we’ll be using the built-in clip utility in Windows 7 or Vista—if you are using Windows XP, you can download clip.exe from Microsoft, just make sure to save the file in the Windows directory.

To copy text from a command to the clipboard, we’ll just pipe it into the clip command, like this:

<command> | clip

For example, if you wanted to output from the echo command into the clipboard, you could do this:

You can also use redirection to send a text file directly into the clip utility, like this:

clip < filename.txt

In this example I’m gonna put the contents of the single.php file onto the clipboard:

Of course, you could also use the type command and then pipe it to the clipboard like so:

Regardless of the one you use, you’ll then be able to paste the content into any other application that you’d like:

Create a Context Menu Helper to Copy File Contents to the Clipboard

You can take the clip utility a step further by adding a context menu item that lets you copy the contents of any file directly to the clipboard. All you’ll need to do is follow the instructions in the following article, or download the reghack file.

Create a Context Menu Item to Copy a Text File To the Clipboard in Windows 7 / Vista / XP

And of course, don’t forget that you can always copy the path of the file to the clipboard through the context menu.

READ NEXT

  • › 20 of the Best Tips and Tricks for Getting the Most out of the Windows Command Line
  • › How to Change Your Age on TikTok
  • › Get PC Power With Tablet Portability in the Surface Pro 9 for $200 Off
  • › This Huge Curved Ultrawide Monitor From LG Is $337 Today
  • › PSA: You Can Email Books and Documents to Your Kindle
  • › How to Screen Record on iPhone
  • › The New HP Pro x360 Fortis Is a 2-In-1 Laptop Under $500

How-To Geek is where you turn when you want experts to explain technology. Since we launched in 2006, our articles have been read billions of times. Want to know more?

Home

August 08, 2013
Amit Agarwal

Google Developer Expert

Like it or not, the command prompt is still an indispensable part of your Windows computer because there are still a bunch of things that can only be done by writing commands.

For instance, if the computer isn’t connecting to the Internet, you will probably be interested in the output of the “ping” or the “tracert” command. If you need to print the contents of a directory in Windows, the command “dir” will come to your rescue.

Copy Output to Clipboard Copy command line output to Windows Clipboard

Now here’s a little trick. If you add the pipe* operator (|) to your command followed by the “clip” command, the output of your original command will get saved to the Windows clipboard and won’t print inside the Command Prompt window.

Here are some examples:

  • dir | clip Copy the content of a folder to the clipboard.
  • tree | clip  Display the recursive directory structure and save it to the clipboard.
  • type error.log | clip Place the content of the file error.log to the clipboard.
  • sort file.txt | clip Sort the file and save the sorted output to the clipbord.
  • ipconfig /all | clip Get details of your network connection for sending to tech support.

The “clip” command may not be available on Windows XP but in that case, you can use the redirect operators, like > and >>, for saving the command output to a text file.

Alternatively, right-click anywhere inside the command window, select Mark from the contextual menu, use the mouse to highlight a block text and then press Enter to save it to the clipboard.

[*] The pipe operator (|) takes the output of one command and directs it into the input of another command which in our case is clip.

Amit Agarwal

0

Digital Inspiration has won several awards since it’s launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Subscribe to our YouTube channel and get notified whenever we upload a new video tutorial.

  • Automate Document Workflow with Google Forms and Sheets

    Automate Document Workflow with Google Forms and Sheets

  • How to Sell Digital Goods with PayPal and Google Sheets

    How to Sell Digital Goods with PayPal and Google Sheets

  • Google Apps Script - A Developer's Guide

    Google Apps Script — A Developer’s Guide

  • Convert Google Slides to Video and Animated GIFs

    Convert Google Slides to Video and Animated GIFs

  • Mail Merge for Gmail with Attachments

    Mail Merge for Gmail with Attachments

  • File Upload Forms for Google Drive

    File Upload Forms for Google Drive

  • Dictation - Type with your Voice

    Dictation — Type with your Voice

  • Email Google Sheets Automatically

    Email Google Sheets Automatically

  • YouTube Video Uploader for Teams

    YouTube Video Uploader for Teams

  • Limit Google Form Responses Automatically

    Limit Google Form Responses Automatically

  • Create PDF Documents from Google Forms

    Create PDF Documents from Google Forms

  • Email Notifications for Google Forms

    Email Notifications for Google Forms

  • How to Hide Files inside Google Drive

    How to Hide Files inside Google Drive

  • Create Merge Documents with Google Sheets or Google Forms

    Create Merge Documents with Google Sheets or Google Forms

  • Create PDF Documents with Images and QR Codes

    Create PDF Documents with Images and QR Codes

  • Send Unique File Attachments with Mail Merge for Gmail

    Send Unique File Attachments with Mail Merge for Gmail

  • Print Password Protected PDF Files

    Print Password Protected PDF Files

  • Embed Google Photos in your Website

    Embed Google Photos in your Website

  • Chrome Developer Tools - Video Tutorial

    Chrome Developer Tools — Video Tutorial

  • How to Reveal the Hidden Password on the Login Page

    How to Reveal the Hidden Password on the Login Page

  • Secure Passwords

    Secure Passwords

  • Save Gmail Emails to Google Drive

    Save Gmail Emails to Google Drive

  • Send Confirmation Emails with Google Forms

    Send Confirmation Emails with Google Forms

  • Create Emoji Art with Google Sheets

    Create Emoji Art with Google Sheets

  • Sender Icons for Gmail and Google Inbox

    Sender Icons for Gmail and Google Inbox

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.

There is a very unknown command in Windows command prompt named as CLIP. This command can be used to copy the output of command in command prompt to windows clipboard. We can use clip command to copy list of folders and files names, directory structure, ping command output, copy file content and much more.

See also: Add Windows User Command line

Syntax of CLIP command

This command is available in Windows 7 and Window 8.x versions if you are Windows XP user and want to use clip command then google it to download Clip.exe and save it in you windows directory.

Advertisement

<command> | clip

dir | clip

here dir is windows command which output put the list of directory and file of current location and “| clip” (pipe sign clip) is used to copy the output of the command to windows clipboard.

command-prompt-dir-output-to-clipboard

As you can see the output is pasted in the notepad.

directory-list-output

Ping yahoo.com | clip

Windows Ping command is use to diagnose / troubleshoot network related problems. If you want to send the output of this command to network administrator then using this command with combination of clip is great idea and save output to windows clipboard.

ping-command-output-to-clipboard-clip-command
ping-output-clip-command

More ideas to use Windows clip command:

ipconfig | clip
You can use above command to save all the details about your network IP addresses, Network devices’ Mac address and much more.

ipconfig -all| clip
You can use “-all” switch with this command to copy the complete list of ipconfig to clipboard.

tasklist | clip
Save the list of currently active running tasks in task manager to clipboard.

tasklist - m | clip
You can use “-m” switch with the command to save some extra details about task DLLs associated with it.

type filename.txt | clip

This command will copy the content of the file to the clipboard.

You can use clip with different command, this is where I found useful using clip command, share below in comment how do you use it.

I expect something simple like «put2clip c:boot.ini» which would result in the same thing as right-clicking in explorer the boot.ini file and select ‘copy’.

i looked at nirsoft’s nircmd, thinkingms.com/pensieve/2009/03/14/ClipexeACommandLineToolForTheWindowsClipboard.aspx and steve.org.uk/Software/clipboard/ bot none of them seems to do the work or provide good documentation.

thanks.

grufftech's user avatar

grufftech

6,6804 gold badges35 silver badges37 bronze badges

asked Jul 20, 2010 at 16:07

user48831's user avatar

1

You don’t specify which flavour of Windows, but anything from Vista/2003 onwards should work doing this:

echo blah | clip

or

type myTextFile.txt | clip

However, I am not aware of a way to put an object (like a file (jpg, mp3, ini, etc)) into the clipboard from the command line using native tools.

answered Jul 20, 2010 at 16:15

Izzy's user avatar

IzzyIzzy

8,2142 gold badges30 silver badges35 bronze badges

2

Like this post? Please share to your friends:
  • Windows copy ssh key to server
  • Windows converter wav to mp3 converter
  • Windows convert dynamic disk to basic disk
  • Windows connection manager что это за служба
  • Windows compile c from command line