{"id":4395,"date":"2016-10-23T12:06:18","date_gmt":"2016-10-23T06:36:18","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=4395"},"modified":"2021-07-01T11:58:46","modified_gmt":"2021-07-01T06:28:46","slug":"copy-command-prompt-output-clipboard-save-file","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/copy-command-prompt-output-clipboard-save-file\/","title":{"rendered":"How to Copy Command Prompt Output Text to Clipboard or File"},"content":{"rendered":"<p>Windows Command-line tools are great for troubleshooting, as well as automation. But, if you&#8217;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.<\/p>\n<p>This post explains how to copy or redirect Command Prompt output to a file or the clipboard.<!--more--><\/p>\n<div id=\"toc\">\n<p><strong>Table of Contents<\/strong><\/p>\n<ul>\n<li><a href=\"#opencmd\">Open a Command Prompt window<\/a><\/li>\n<li><a href=\"#copycmd\">Copy Command Prompt output to Clipboard<\/a>\n<ul>\n<li><a href=\"#copykeyboard\">Using keyboard shortcuts<\/a><\/li>\n<li><a href=\"#copyedit\">Using the Edit menu<\/a><\/li>\n<li><a href=\"#copytoclip\">Piping the output to Clip (Clip.exe tool)<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#redirect\">Redirect Command-line output to a file<\/a>\n<ul>\n<li><a href=\"#redirect\">Redirecting the output to a new file<\/a><\/li>\n<li><a href=\"#redirectappend\">Redirecting the output to a file (append contents)<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#screenshot\">Take a Screenshot<\/a><\/li>\n<\/ul>\n<\/div>\n<h2>Copy Command Prompt Output Text to Clipboard or File<\/h2>\n<h3><a id=\"opencmd\"><\/a>Opening a Command Prompt window<\/h3>\n<p>To open a Command Prompt window, press <kbd>WinKey<\/kbd> + <kbd>R<\/kbd> to launch the Run dialog. Type in <code>cmd.exe<\/code> 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.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4399\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/command-prompt-header.png\" alt=\"Command Prompt window\" width=\"650\" height=\"200\" \/><\/p>\n<p>If the console tool you&#8217;re running or the operation you&#8217;re performing requires administrative privileges, you need to <a href=\"www.winhelponline.com\/blog\/open-elevated-command-prompt-windows\/\">open Command Prompt as administrator<\/a> (also known as &#8220;elevated&#8221; Command Prompt.)<\/p>\n<p>In the Command Prompt window, type in the command you want to run. For example, someone who&#8217;s helping you wants to know your system information by running <code>SystemInfo<\/code> command, type <code>systeminfo<\/code> and press <kbd>ENTER<\/kbd>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4397\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/cmd-output-2.png\" alt=\"copy command prompt output\" width=\"650\" height=\"300\" \/><\/p>\n<h3><a id=\"copycmd\"><\/a>Copying the output to clipboard<\/h3>\n<p>To copy the command prompt output to the clipboard, use one of the methods.<\/p>\n<p><a id=\"copykeyboard\"><\/a><strong>Using Keyboard:<\/strong> Press <strong><kbd>Ctrl<\/kbd> + <kbd>A<\/kbd><\/strong> to select all text, and press <kbd>ENTER<\/kbd> to copy it to the clipboard.<\/p>\n<p><a id=\"copyedit\"><\/a><strong>Using the Edit menu:<\/strong> Right-click the Command Prompt title bar \u2192 <strong>Edit<\/strong> \u2192 <strong>Select All<\/strong>. Repeat the same, and this time, select <strong>Copy<\/strong> from the Edit menu.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4398\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/cmd-output-3.png\" alt=\"copy command prompt output\" width=\"650\" height=\"320\" \/><\/p>\n<p><a id=\"copytoclip\"><\/a><strong>Using Clip.exe console tool:<\/strong> The <a href=\"https:\/\/www.winhelponline.com\/articles\/248\/1\/Copy-command-line-output-directly-to-the-Clipboard-using-Clipexe.html\" target=\"_blank\" rel=\"noopener noreferrer\">Clip.exe console tool<\/a> 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 <code>Clip.exe<\/code> tool by piping the output. The command you&#8217;d run is:<\/p>\n<pre>systeminfo |clip<\/pre>\n<p>That would copy the output of the <strong>systeminfo<\/strong> command to the Windows Clipboard. This is done by <code>Clip.exe<\/code> receiving the command-line output directly.<\/p>\n<p>Once the output is sent to the clipboard, you can paste it into a text editor. For example, you can open Notepad and paste (<kbd>Ctrl<\/kbd> + <kbd>V<\/kbd>) the contents there.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4396\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/cmd-output-1.png\" alt=\"copy command prompt output\" width=\"650\" height=\"325\" \/><\/p>\n<h3><a id=\"redirect\"><\/a>Redirecting the output to a new file<\/h3>\n<p><a id=\"redirectnew\"><\/a>You can redirect the command-line output to a <strong>file<\/strong> 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&#8217;s screen buffer size. To output the results to a file, use this syntax\/examples:<\/p>\n<pre>systeminfo &gt;%temp%\\systeminfo.txt<\/pre>\n<p>That would create a file named systeminfo.txt in the user&#8217;s Temp folder. To write the output to a file on your desktop, you&#8217;d use:<\/p>\n<pre>systeminfo &gt;%userprofile%\\desktop\\systeminfo.txt<\/pre>\n<h3><a id=\"redirectappend\"><\/a>Redirecting the output to a file by appending<\/h3>\n<p>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 <code>&gt;&gt;<\/code>, as below:<\/p>\n<pre><code>ipconfig &gt;&gt;%userprofile%\\desktop\\systeminfo.txt\r\nsysteminfo &gt;&gt;%userprofile%\\desktop\\systeminfo.txt<\/code><\/pre>\n<p>That would output the contents of <code>Ipconfig<\/code> and <code>Systeminfo<\/code> commands to the same file. If a file exists with the same name <code>systeminfo.txt<\/code>, it would be used. Otherwise, a new file would be created.<\/p>\n<p><strong>Another example<\/strong><\/p>\n<pre><code>ipconfig &gt;%userprofile%\\desktop\\info.txt\r\nsc query wuauserv &gt;&gt;%userprofile%\\desktop\\info.txt\r\ndir d:\\tools\\*.exe &gt;&gt;%userprofile%\\desktop\\info.txt\r\ndir C:\\Windows\\System32\\Tasks \/s \/b &gt;&gt;%userprofile%\\desktop\\info.txt<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4401\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/cmd-output-5.png\" alt=\"Command Prompt window\" width=\"650\" height=\"258\" \/><\/p>\n<p>The first command would create a new file (as a single <code>&gt;<\/code> symbol is used) named <code>info.txt<\/code>. Subsequent commands would output the results to the existing <code>info.txt<\/code> file (double <code>&gt;&gt;<\/code> symbol).<\/p>\n<h3><a id=\"screenshot\"><\/a>Take a Screenshot<\/h3>\n<p>In some cases, you may not require the text output, and a screenshot is sufficient. <kbd>Win<\/kbd> + <kbd>PrntScrn<\/kbd> keystroke is used to take a screenshot quickly in Windows 8 and 10. Or use the excellent built-in Snipping Tool. Check out <a href=\"https:\/\/www.winhelponline.com\/blog\/take-screenshot-windows-different-ways-prnt-scrn\/\">How to Take a Screenshot in Windows<\/a> for a detailed guide.<\/p>\n<p>I hope this guide helped you learn how to copy or redirect Command Prompt output to a file or the clipboard.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows Command-line tools are great for troubleshooting, as well as automation. But, if you&#8217;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 &#8230; <a title=\"How to Copy Command Prompt Output Text to Clipboard or File\" class=\"read-more\" href=\"https:\/\/www.winhelponline.com\/blog\/copy-command-prompt-output-clipboard-save-file\/\" aria-label=\"Read more about How to Copy Command Prompt Output Text to Clipboard or File\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[106],"class_list":["post-4395","post","type-post","status-publish","format-standard","hentry","category-windows","tag-command-prompt"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":4261,"url":"https:\/\/www.winhelponline.com\/blog\/print-directory-contents-using-chrome-firefox\/","url_meta":{"origin":4395,"position":0},"title":"How to Print Directory Contents Using Different Methods","author":"Ramesh","date":"October 4, 2016","format":false,"excerpt":"You can copy folder contents by selecting all items in a folder, pressing Shift key and clicking the Copy as Path command in the right-click menu. Then open Notepad or any other text editor and paste the contents from the clipboard. But if you need to print the directory list\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"get directory listing - sysexporter","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/dir-list-sysexporter.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/dir-list-sysexporter.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/dir-list-sysexporter.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/dir-list-sysexporter.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":275,"url":"https:\/\/www.winhelponline.com\/blog\/add-copy-as-path-right-click-menu-in-xp\/","url_meta":{"origin":4395,"position":1},"title":"How to Add &#8220;Copy as Path&#8221; to Right Click Menu in Windows XP","author":"Ramesh","date":"May 10, 2008","format":false,"excerpt":"Windows Vista and higher already include the useful Copy as Path option in the context menu, which helps you quickly copy the complete path of the selected file(s) or folder(s) to the Clipboard. Here is how to add \"Copy of Path\" feature in Windows XP. There are two methods discussed,\u2026","rel":"","context":"In &quot;Windows XP&quot;","block_context":{"text":"Windows XP","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-xp\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/archived\/copypath.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":9532,"url":"https:\/\/www.winhelponline.com\/blog\/how-to-get-file-hash-via-right-click-menu-windows\/","url_meta":{"origin":4395,"position":2},"title":"Get File Hash Checksum (MD5, SHA-256) via Right-click Menu","author":"Ramesh","date":"May 26, 2019","format":false,"excerpt":"Hashing means taking an input string of any length and giving out an output of a fixed length. Using the cryptographic hashing algorithm -- e.g., MD5, SHA-256, SHA-384, you can verify if two files are identical or not. The checksum is a hash value used for performing data integrity checks\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"get file hash right-click menu 7-zip","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/7zip-get-file-hash-crc-sha-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/7zip-get-file-hash-crc-sha-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/7zip-get-file-hash-crc-sha-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/7zip-get-file-hash-crc-sha-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":929,"url":"https:\/\/www.winhelponline.com\/blog\/enable-quick-edit-command-prompt-by-default\/","url_meta":{"origin":4395,"position":3},"title":"How to Enable Quick Edit Mode in the Command Prompt by Default","author":"Ramesh","date":"September 22, 2009","format":false,"excerpt":"You can use the mouse to copy Command Prompt text to the clipboard by enabling the Quick Edit option in Command Prompt shortcut properties. What if you don't use a desktop shortcut to open Command Prompt, and rather run cmd.exe directly? Here is a registry edit which enables Quick Edit\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9385,"url":"https:\/\/www.winhelponline.com\/blog\/how-to-extract-links-from-a-webpage-in-windows\/","url_meta":{"origin":4395,"position":4},"title":"How to Extract Links from a Webpage in Windows","author":"Ramesh","date":"May 19, 2019","format":false,"excerpt":"You may need to extract the links (URLs) in a webpage for different purposes -- eg., internet research, web development, security assessments, or webpage testing. This article tells you how to extract links from a webpage or HTML document in Windows. How to Extract Links from a Webpage in Windows\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"extract links from a webpage in windows","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-links-addrview.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-links-addrview.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-links-addrview.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-links-addrview.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4448,"url":"https:\/\/www.winhelponline.com\/blog\/find-process-locked-file-openfiles-utility\/","url_meta":{"origin":4395,"position":5},"title":"How to Find Which Process has Locked a File in Windows","author":"Ramesh","date":"October 28, 2016","format":false,"excerpt":"When you attempt to delete a file or folder which is in use by a process, the File In Use dialog appears showing the name of the program that has locked the file. However, there are cases where the \"File In Use\" dialog doesn't show the name of the process\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"Find Which Process Has Locked a File","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/file-locked-open-in-another-program.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/file-locked-open-in-another-program.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/10\/file-locked-open-in-another-program.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/4395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=4395"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/4395\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=4395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=4395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=4395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}