If you are a computer science student then must have worked on command prompt (also called cmd). During practical days while making practical file you must have wondered how to copy content from command prompt to MS-Word or for that matter any other text editor like notepad, notepad++ etc.
Most of you must have taken the screen shot and have edited into paint software to print the output. That’s a lot work for just a small thing. You know there is an easy way of copying content from command prompt.
Command to Copy Output from cmd
It’s the CLIP command.
In operating system there is a clipboard. Whenever we copy something it gets copied to clipboard. Clipboard works like a common interface between software for transferring content.
How to use CLIP command?
It’s very easy: If you like to take output of command dir (which displays directory content) then just type dir | clip and your output will get copied to clipboard. Now you can paste it anywhere you want (MS-Word, notepad, any text editor).
Little Technical Detail
Observe the command. There is a pipe sign before clip command. For the record a pipe works like: Output of first command becomes input for second command. Because our second command is clip which transfers output to clipboard. So, out of first command is transferred to clipboard via clip.
I haven’t checked it on windows XP or older, but it’s working on windows 7.
Alternative of clip
Clip transfers output to clipboard and then we need to paste that to somewhere but there is one more way by which we can transfer output directly to a file. It won’t be append, it will create a new file. Of course, if you know enough about shell programming then you can tweak it the way you like.
While generating output, do this:
YOUR_COMMAND > MY_OUTPUT.txt
For Ex: dir > my-log.txt
This will write directory listing into a file named my-log.txt and you can use that the way you like.
So from now on you don’t have to take screenshot while dealing with command prompt outputs. Simply transfer the output of any command to clipboard via clip and paste to any text editing tool like MS-Word.