Copy content of txt file without opening it
Is there a way or program to copy content of .txt
file to clipboard without opening it?
Now I have to open->ctrl+a->ctrl+c->close
. A little bit annoying if you do it often.
Is there a possible shortcut for this operation?
There's a clipboard utility in Windows called clip.exe
.
In the command prompt, you can copy the contents of a file to your clipboard using
clip < file.txt
This will be useful if you use the command prompt often. If you don't, you can add it to your context menu. I've just tested this out with instructions from HowToGeek on Windows 7, but I had to make a little tweak before I got it to work.
HowToGeek has also mentioned that clip.exe
does not come with XP, so you'll have to download it from Microsoft FTP here and place it in your Windows system directory.
Steps:
- Open
regedit.exe
- Go to
HKEY_CLASSES_ROOT/txtfile/shell
(This didn't work for me so I had to put it underHKEY_CLASSES_ROOT/*/shell
, which makes it show up in EVERY context menu)- Add a new key titled
copytoclip
- Set the default value of
copytoclip
to something likeCopy to Clipboard
- Under
copytoclip
, add a key calledcommand
- Set the default value of
command
tocmd /c clip < "%1"
Now whenever you right click on a file, you should see a Copy to Clipboard
option. What it does it that when you click on it, it will open a command prompt and run the clip.exe
utility on the output piped from the file you selected.
For XP I generally us the Send To X powertoy available from Microsoft.
http://technet.microsoft.com/en-us/library/cc751394.aspx
And while I'll probably go with Jin's answer which I also upvoted on Win7. One of the things I love about SendToX is the send to clipboard as name. I have probably averaged 4 uses per day of this since it came out with Win95.