How to copy text from the cmd console and keep the formatting (with color)?












13















I want to cut and paste from cmd and keep the color information when pasting to another application. It's similar to pasting in most applications with formatting information.



Is there a way to do this? Or can it be done with an app similar to cmd?



alt text










share|improve this question





























    13















    I want to cut and paste from cmd and keep the color information when pasting to another application. It's similar to pasting in most applications with formatting information.



    Is there a way to do this? Or can it be done with an app similar to cmd?



    alt text










    share|improve this question



























      13












      13








      13


      5






      I want to cut and paste from cmd and keep the color information when pasting to another application. It's similar to pasting in most applications with formatting information.



      Is there a way to do this? Or can it be done with an app similar to cmd?



      alt text










      share|improve this question
















      I want to cut and paste from cmd and keep the color information when pasting to another application. It's similar to pasting in most applications with formatting information.



      Is there a way to do this? Or can it be done with an app similar to cmd?



      alt text







      windows command-line formatting






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 26 '11 at 4:04









      3498DB

      15.8k114862




      15.8k114862










      asked Dec 2 '09 at 12:54









      Keith BentrupKeith Bentrup

      220210




      220210






















          3 Answers
          3






          active

          oldest

          votes


















          6














          The PowerShell folks, on their blog, posted an article titled: Colorized capture of console screen in HTML and RTF



          Once it's in a RTF file, with colors, open the RTF with Word or OpenOffice and copy the text to your target application.



          As PowerShell is a nice replacement of cmd.exe with a lot more features, give it a try.






          share|improve this answer



















          • 2





            It's not so much a replacement as an alternative. Compatibility dictates that it can't replace cmd :-)

            – Joey
            Dec 2 '09 at 14:54











          • Yes, you're right, Johannes! "Danke schön" for the clarification :-) .

            – Snark
            Dec 2 '09 at 15:00











          • +Awesome! Thanks. It was a bit confusing at first since I had never used PowerShell, but it worked exactly as described.

            – Keith Bentrup
            Dec 3 '09 at 11:08











          • There is a Gist with the code: gist.github.com/LeoColomb/1a683e7a05da067259e9

            – dualed
            Oct 25 '18 at 11:41



















          0














          Colours in cmd are not the same as normal colours, it's the interpreter interpreting colour codes. I do not believe it's possible to do, and checking in Console2, it can't do it either, so it's probably for a very good reason.






          share|improve this answer
























          • AFAIK, Windows Console doesn't support ANSI colour codes (as Unix terminal emulators do); the program must call special functions to set the text colour. Also, a program can read the complete contents of its screen buffer (that's how that PowerShell snippet works) -- and it would be possible to make Console2 remember everything too. There's no real reason preventing it.

            – grawity
            Dec 2 '09 at 13:53











          • Well, I'm often wrong ;) I assumed the two would work similarly, as cygwin's tools have working colour, but they must have implemented that themselves.

            – Phoshi
            Dec 2 '09 at 16:16











          • @grawity looks like ansi is supported natively in windows console in windows 10 msdn.microsoft.com/en-us/library/windows/desktop/…

            – Antony Hatchkins
            Nov 14 '16 at 5:43



















          0














          There is a long winded way of doing it, using screen capture?




          1. Hit Alt+PrtScr

          2. This will copy the window to the clipboard

          3. From Start, enter mspaint

          4. Click on Edit/Paste or Ctrl-V to paste the contents of clipboard

          5. Edit it to only show the command box and save it to PNG (GIF will lead to Paint dithering the classic grey text, and JPEG would create artefacts around your text).


          Then those screen capture shots, will be ready to be inserted into Word as an image for documenting purposes. Of course, it's not text, so it won't be selectable. But it may be better than nothing.






          share|improve this answer


























          • The only thing this workaround is missing would be running OCR against the output image :) Overkill? Possibly, but probably easier to deal with than the accepted answer.

            – kayleeFrye_onDeck
            Feb 14 at 21:05












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f77781%2fhow-to-copy-text-from-the-cmd-console-and-keep-the-formatting-with-color%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          6














          The PowerShell folks, on their blog, posted an article titled: Colorized capture of console screen in HTML and RTF



          Once it's in a RTF file, with colors, open the RTF with Word or OpenOffice and copy the text to your target application.



          As PowerShell is a nice replacement of cmd.exe with a lot more features, give it a try.






          share|improve this answer



















          • 2





            It's not so much a replacement as an alternative. Compatibility dictates that it can't replace cmd :-)

            – Joey
            Dec 2 '09 at 14:54











          • Yes, you're right, Johannes! "Danke schön" for the clarification :-) .

            – Snark
            Dec 2 '09 at 15:00











          • +Awesome! Thanks. It was a bit confusing at first since I had never used PowerShell, but it worked exactly as described.

            – Keith Bentrup
            Dec 3 '09 at 11:08











          • There is a Gist with the code: gist.github.com/LeoColomb/1a683e7a05da067259e9

            – dualed
            Oct 25 '18 at 11:41
















          6














          The PowerShell folks, on their blog, posted an article titled: Colorized capture of console screen in HTML and RTF



          Once it's in a RTF file, with colors, open the RTF with Word or OpenOffice and copy the text to your target application.



          As PowerShell is a nice replacement of cmd.exe with a lot more features, give it a try.






          share|improve this answer



















          • 2





            It's not so much a replacement as an alternative. Compatibility dictates that it can't replace cmd :-)

            – Joey
            Dec 2 '09 at 14:54











          • Yes, you're right, Johannes! "Danke schön" for the clarification :-) .

            – Snark
            Dec 2 '09 at 15:00











          • +Awesome! Thanks. It was a bit confusing at first since I had never used PowerShell, but it worked exactly as described.

            – Keith Bentrup
            Dec 3 '09 at 11:08











          • There is a Gist with the code: gist.github.com/LeoColomb/1a683e7a05da067259e9

            – dualed
            Oct 25 '18 at 11:41














          6












          6








          6







          The PowerShell folks, on their blog, posted an article titled: Colorized capture of console screen in HTML and RTF



          Once it's in a RTF file, with colors, open the RTF with Word or OpenOffice and copy the text to your target application.



          As PowerShell is a nice replacement of cmd.exe with a lot more features, give it a try.






          share|improve this answer













          The PowerShell folks, on their blog, posted an article titled: Colorized capture of console screen in HTML and RTF



          Once it's in a RTF file, with colors, open the RTF with Word or OpenOffice and copy the text to your target application.



          As PowerShell is a nice replacement of cmd.exe with a lot more features, give it a try.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 2 '09 at 13:39









          SnarkSnark

          29.1k67689




          29.1k67689








          • 2





            It's not so much a replacement as an alternative. Compatibility dictates that it can't replace cmd :-)

            – Joey
            Dec 2 '09 at 14:54











          • Yes, you're right, Johannes! "Danke schön" for the clarification :-) .

            – Snark
            Dec 2 '09 at 15:00











          • +Awesome! Thanks. It was a bit confusing at first since I had never used PowerShell, but it worked exactly as described.

            – Keith Bentrup
            Dec 3 '09 at 11:08











          • There is a Gist with the code: gist.github.com/LeoColomb/1a683e7a05da067259e9

            – dualed
            Oct 25 '18 at 11:41














          • 2





            It's not so much a replacement as an alternative. Compatibility dictates that it can't replace cmd :-)

            – Joey
            Dec 2 '09 at 14:54











          • Yes, you're right, Johannes! "Danke schön" for the clarification :-) .

            – Snark
            Dec 2 '09 at 15:00











          • +Awesome! Thanks. It was a bit confusing at first since I had never used PowerShell, but it worked exactly as described.

            – Keith Bentrup
            Dec 3 '09 at 11:08











          • There is a Gist with the code: gist.github.com/LeoColomb/1a683e7a05da067259e9

            – dualed
            Oct 25 '18 at 11:41








          2




          2





          It's not so much a replacement as an alternative. Compatibility dictates that it can't replace cmd :-)

          – Joey
          Dec 2 '09 at 14:54





          It's not so much a replacement as an alternative. Compatibility dictates that it can't replace cmd :-)

          – Joey
          Dec 2 '09 at 14:54













          Yes, you're right, Johannes! "Danke schön" for the clarification :-) .

          – Snark
          Dec 2 '09 at 15:00





          Yes, you're right, Johannes! "Danke schön" for the clarification :-) .

          – Snark
          Dec 2 '09 at 15:00













          +Awesome! Thanks. It was a bit confusing at first since I had never used PowerShell, but it worked exactly as described.

          – Keith Bentrup
          Dec 3 '09 at 11:08





          +Awesome! Thanks. It was a bit confusing at first since I had never used PowerShell, but it worked exactly as described.

          – Keith Bentrup
          Dec 3 '09 at 11:08













          There is a Gist with the code: gist.github.com/LeoColomb/1a683e7a05da067259e9

          – dualed
          Oct 25 '18 at 11:41





          There is a Gist with the code: gist.github.com/LeoColomb/1a683e7a05da067259e9

          – dualed
          Oct 25 '18 at 11:41













          0














          Colours in cmd are not the same as normal colours, it's the interpreter interpreting colour codes. I do not believe it's possible to do, and checking in Console2, it can't do it either, so it's probably for a very good reason.






          share|improve this answer
























          • AFAIK, Windows Console doesn't support ANSI colour codes (as Unix terminal emulators do); the program must call special functions to set the text colour. Also, a program can read the complete contents of its screen buffer (that's how that PowerShell snippet works) -- and it would be possible to make Console2 remember everything too. There's no real reason preventing it.

            – grawity
            Dec 2 '09 at 13:53











          • Well, I'm often wrong ;) I assumed the two would work similarly, as cygwin's tools have working colour, but they must have implemented that themselves.

            – Phoshi
            Dec 2 '09 at 16:16











          • @grawity looks like ansi is supported natively in windows console in windows 10 msdn.microsoft.com/en-us/library/windows/desktop/…

            – Antony Hatchkins
            Nov 14 '16 at 5:43
















          0














          Colours in cmd are not the same as normal colours, it's the interpreter interpreting colour codes. I do not believe it's possible to do, and checking in Console2, it can't do it either, so it's probably for a very good reason.






          share|improve this answer
























          • AFAIK, Windows Console doesn't support ANSI colour codes (as Unix terminal emulators do); the program must call special functions to set the text colour. Also, a program can read the complete contents of its screen buffer (that's how that PowerShell snippet works) -- and it would be possible to make Console2 remember everything too. There's no real reason preventing it.

            – grawity
            Dec 2 '09 at 13:53











          • Well, I'm often wrong ;) I assumed the two would work similarly, as cygwin's tools have working colour, but they must have implemented that themselves.

            – Phoshi
            Dec 2 '09 at 16:16











          • @grawity looks like ansi is supported natively in windows console in windows 10 msdn.microsoft.com/en-us/library/windows/desktop/…

            – Antony Hatchkins
            Nov 14 '16 at 5:43














          0












          0








          0







          Colours in cmd are not the same as normal colours, it's the interpreter interpreting colour codes. I do not believe it's possible to do, and checking in Console2, it can't do it either, so it's probably for a very good reason.






          share|improve this answer













          Colours in cmd are not the same as normal colours, it's the interpreter interpreting colour codes. I do not believe it's possible to do, and checking in Console2, it can't do it either, so it's probably for a very good reason.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 2 '09 at 13:05









          PhoshiPhoshi

          21.2k25277




          21.2k25277













          • AFAIK, Windows Console doesn't support ANSI colour codes (as Unix terminal emulators do); the program must call special functions to set the text colour. Also, a program can read the complete contents of its screen buffer (that's how that PowerShell snippet works) -- and it would be possible to make Console2 remember everything too. There's no real reason preventing it.

            – grawity
            Dec 2 '09 at 13:53











          • Well, I'm often wrong ;) I assumed the two would work similarly, as cygwin's tools have working colour, but they must have implemented that themselves.

            – Phoshi
            Dec 2 '09 at 16:16











          • @grawity looks like ansi is supported natively in windows console in windows 10 msdn.microsoft.com/en-us/library/windows/desktop/…

            – Antony Hatchkins
            Nov 14 '16 at 5:43



















          • AFAIK, Windows Console doesn't support ANSI colour codes (as Unix terminal emulators do); the program must call special functions to set the text colour. Also, a program can read the complete contents of its screen buffer (that's how that PowerShell snippet works) -- and it would be possible to make Console2 remember everything too. There's no real reason preventing it.

            – grawity
            Dec 2 '09 at 13:53











          • Well, I'm often wrong ;) I assumed the two would work similarly, as cygwin's tools have working colour, but they must have implemented that themselves.

            – Phoshi
            Dec 2 '09 at 16:16











          • @grawity looks like ansi is supported natively in windows console in windows 10 msdn.microsoft.com/en-us/library/windows/desktop/…

            – Antony Hatchkins
            Nov 14 '16 at 5:43

















          AFAIK, Windows Console doesn't support ANSI colour codes (as Unix terminal emulators do); the program must call special functions to set the text colour. Also, a program can read the complete contents of its screen buffer (that's how that PowerShell snippet works) -- and it would be possible to make Console2 remember everything too. There's no real reason preventing it.

          – grawity
          Dec 2 '09 at 13:53





          AFAIK, Windows Console doesn't support ANSI colour codes (as Unix terminal emulators do); the program must call special functions to set the text colour. Also, a program can read the complete contents of its screen buffer (that's how that PowerShell snippet works) -- and it would be possible to make Console2 remember everything too. There's no real reason preventing it.

          – grawity
          Dec 2 '09 at 13:53













          Well, I'm often wrong ;) I assumed the two would work similarly, as cygwin's tools have working colour, but they must have implemented that themselves.

          – Phoshi
          Dec 2 '09 at 16:16





          Well, I'm often wrong ;) I assumed the two would work similarly, as cygwin's tools have working colour, but they must have implemented that themselves.

          – Phoshi
          Dec 2 '09 at 16:16













          @grawity looks like ansi is supported natively in windows console in windows 10 msdn.microsoft.com/en-us/library/windows/desktop/…

          – Antony Hatchkins
          Nov 14 '16 at 5:43





          @grawity looks like ansi is supported natively in windows console in windows 10 msdn.microsoft.com/en-us/library/windows/desktop/…

          – Antony Hatchkins
          Nov 14 '16 at 5:43











          0














          There is a long winded way of doing it, using screen capture?




          1. Hit Alt+PrtScr

          2. This will copy the window to the clipboard

          3. From Start, enter mspaint

          4. Click on Edit/Paste or Ctrl-V to paste the contents of clipboard

          5. Edit it to only show the command box and save it to PNG (GIF will lead to Paint dithering the classic grey text, and JPEG would create artefacts around your text).


          Then those screen capture shots, will be ready to be inserted into Word as an image for documenting purposes. Of course, it's not text, so it won't be selectable. But it may be better than nothing.






          share|improve this answer


























          • The only thing this workaround is missing would be running OCR against the output image :) Overkill? Possibly, but probably easier to deal with than the accepted answer.

            – kayleeFrye_onDeck
            Feb 14 at 21:05
















          0














          There is a long winded way of doing it, using screen capture?




          1. Hit Alt+PrtScr

          2. This will copy the window to the clipboard

          3. From Start, enter mspaint

          4. Click on Edit/Paste or Ctrl-V to paste the contents of clipboard

          5. Edit it to only show the command box and save it to PNG (GIF will lead to Paint dithering the classic grey text, and JPEG would create artefacts around your text).


          Then those screen capture shots, will be ready to be inserted into Word as an image for documenting purposes. Of course, it's not text, so it won't be selectable. But it may be better than nothing.






          share|improve this answer


























          • The only thing this workaround is missing would be running OCR against the output image :) Overkill? Possibly, but probably easier to deal with than the accepted answer.

            – kayleeFrye_onDeck
            Feb 14 at 21:05














          0












          0








          0







          There is a long winded way of doing it, using screen capture?




          1. Hit Alt+PrtScr

          2. This will copy the window to the clipboard

          3. From Start, enter mspaint

          4. Click on Edit/Paste or Ctrl-V to paste the contents of clipboard

          5. Edit it to only show the command box and save it to PNG (GIF will lead to Paint dithering the classic grey text, and JPEG would create artefacts around your text).


          Then those screen capture shots, will be ready to be inserted into Word as an image for documenting purposes. Of course, it's not text, so it won't be selectable. But it may be better than nothing.






          share|improve this answer















          There is a long winded way of doing it, using screen capture?




          1. Hit Alt+PrtScr

          2. This will copy the window to the clipboard

          3. From Start, enter mspaint

          4. Click on Edit/Paste or Ctrl-V to paste the contents of clipboard

          5. Edit it to only show the command box and save it to PNG (GIF will lead to Paint dithering the classic grey text, and JPEG would create artefacts around your text).


          Then those screen capture shots, will be ready to be inserted into Word as an image for documenting purposes. Of course, it's not text, so it won't be selectable. But it may be better than nothing.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 14 at 23:18

























          answered Dec 2 '09 at 14:30









          t0mm13bt0mm13b

          673514




          673514













          • The only thing this workaround is missing would be running OCR against the output image :) Overkill? Possibly, but probably easier to deal with than the accepted answer.

            – kayleeFrye_onDeck
            Feb 14 at 21:05



















          • The only thing this workaround is missing would be running OCR against the output image :) Overkill? Possibly, but probably easier to deal with than the accepted answer.

            – kayleeFrye_onDeck
            Feb 14 at 21:05

















          The only thing this workaround is missing would be running OCR against the output image :) Overkill? Possibly, but probably easier to deal with than the accepted answer.

          – kayleeFrye_onDeck
          Feb 14 at 21:05





          The only thing this workaround is missing would be running OCR against the output image :) Overkill? Possibly, but probably easier to deal with than the accepted answer.

          – kayleeFrye_onDeck
          Feb 14 at 21:05


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f77781%2fhow-to-copy-text-from-the-cmd-console-and-keep-the-formatting-with-color%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Mouse cursor on multiple screens with different PPI

          Agildo Ribeiro

          Sometime when accessing a menu: “Ubuntu 16.04 has experienced an internal error”