将code添加到上下文菜单_创建上下文菜单项以将文本文件复制到Windows 7 / Vista / XP中的剪贴板...

将code添加到上下文菜单_创建上下文菜单项以将文本文件复制到Windows 7 / Vista / XP中的剪贴板...

将code添加到上下文菜单

If you are the type of person that likes to keep a lot of information stored in text-format files on your drive, you’ve probably encountered a scenario where you want to copy that information to the clipboard… so you open the file in notepad, select all, then copy to the clipboard. What if you could do it with a simple context menu item instead?

如果您是那种喜欢将大量信息存储在驱动器上的文本格式文件中的人,则可能遇到了要将这些信息复制到剪贴板的情况……因此您可以在记事本中打开文件,选择全部,然后复制到剪贴板。 如果可以改为使用简单的上下文菜单项怎么办?

Using a little registry hacking and the clip.exe utility built into Windows 7 and Vista, we can do just that, and we can even hide it behind the Shift + Right-Click menu so that it won’t waste space on the menu unless you hold down the shift key.

使用小的注册表黑客攻击和Windows 7和Vista内置的clip.exe实用程序,我们可以做到这一点,甚至可以将其隐藏在Shift +右键单击菜单后面,这样除非您浪费菜单上的空间,否则您按住Shift键。

Using the Copy to Clipboard Hack

使用复制到剪贴板的技巧

Simply hold down the Shift key and right-click on a text file, and you’ll see a new item for “Copy to Clipboard”:

只需按住Shift键并在文本文件上单击鼠标右键,您将看到“复制到剪贴板”的新项目:

将code添加到上下文菜单_创建上下文菜单项以将文本文件复制到Windows 7 / Vista / XP中的剪贴板...

Now you’ll have the information on the clipboard for easy pasting into whatever application you’d like:

现在,您将在剪贴板上获得信息,以便轻松粘贴到所需的任何应用程序中:

将code添加到上下文菜单_创建上下文菜单项以将文本文件复制到Windows 7 / Vista / XP中的剪贴板...

Note: If you are using Windows XP, you can download clip.exe from Microsoft. Just save the file in the Windows directory and the rest of the hack should work for you.

注意:如果使用Windows XP,则可以从Microsoft下载clip.exe 只需将文件保存在Windows目录中,其余的hack就可以为您工作。

Manual Registry Hack (for .txt files)

手动注册表**(.txt文件)

Open up regedit.exe through the start menu search or run box, and then browse down to the following key:

通过开始菜单搜索或运行框打开regedit.exe,然后向下浏览至以下键:

HKEY_CLASSES_ROOT\txtfile\shell

HKEY_CLASSES_ROOT \ txtfile \ shell

将code添加到上下文菜单_创建上下文菜单项以将文本文件复制到Windows 7 / Vista / XP中的剪贴板...

Underneath each file type in the registry (for instance txtfile), there is a shell key with a list of actions under it. We’ll create a new key called “copytoclip”, and then a key under it called “command”. Set the default value of “copytoclip” to something useful like “Copy Contents to Clipboard”, and then set the default value of “command” to the following:

在注册表中每种文件类型(例如txtfile)的下方,都有一个外壳程序键,下面是操作列表。 我们将创建一个名为“ copytoclip”的新**,然后在其下方创建一个名为“ command”的**。 将“ copytoclip”的默认值设置为“将内容复制到剪贴板”之类的有用内容,然后将“ command”的默认值设置为以下内容:

cmd /c clip < "%1"

cmd /c clip < "%1"

What we’re doing is running a command prompt, and then piping the file into the clip.exe utility. You could do the same thing from the command prompt, or in a script.

我们正在做的是运行命令提示符,然后将文件传输到clip.exe实用程序中。 您可以从命令提示符或脚本中执行相同的操作。

You could duplicate this same tweak for other file types, such as html or code files, by finding their key in the registry and adding the same menu items.

您可以通过在注册表中找到它们的键并添加相同的菜单项,来对其他文件类型(例如html或代码文件)进行相同的调整。

Downloadable Registry Hack

可下载的注册表黑客

Simply download, extract, and double-click on CopyContentsToClipboardTXT.reg to the clipboard. You can remove the hacks with the RemoveCopyContentsToClipboard.reg file.

只需下载,提取并双击CopyContentsToClipboardTXT.reg到剪贴板即可。 您可以使用RemoveCopyContentsToClipboard.reg文件删除黑客。

Just remember to hold down the shift key while right-clicking on a text file.

只需记住在右键单击文本文件时按住Shift键即可。

Download CopyContentsToClipboardTXT Registry Hack

下载CopyContentsToClipboardTXT注册表黑客

翻译自: https://www.howtogeek.com/howto/windows-vista/create-a-context-menu-item-to-copy-a-text-file-to-the-clipboard-in-windows-vista/

将code添加到上下文菜单