在 Windows 上下文菜单中复制为路径 [英] Copy as path in windows context menu

查看:30
本文介绍了在 Windows 上下文菜单中复制为路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Windows 上下文菜单中实现复制为路径"选项,它将当前文件或文件夹路径复制到剪贴板而不是为此安装软件,我想自己实现它.有什么建议吗?

I'm trying to implement "Copy as path" option in windows context menu ,which copies current file or folder path to clip board instead of installing a software for this , i would like to implement it my self. Any suggestions?

推荐答案

您可以通过摆弄 File Types 对话框或使用注册表来添加指向上下文菜单的链接.在注册表中,路径是HKEY_CLASSES_ROOT\*\shell.在名为Copy as path"的下添加一个键,在名为command"的下添加一个键.将命令的默认字符串值更改为c:\your-program.exe %1",当用户选择复制为路径"时,它将以该路径作为参数运行您的可执行文件.现在您的可执行文件只需要将传入的路径写入剪贴板

You can add a link to the context menu by fiddling with the File Types dialog, or using the registry. In the registry, the path is HKEY_CLASSES_ROOT\*\shell. Add a key under that named "Copy as path", and a key under that named "command". Change command's default string value to "c:\your-program.exe %1", and when the user selects "Copy as path" it will run your executable with that path as the argument. Now your executable just needs to write the path passed in to it to the clipboard

这篇关于在 Windows 上下文菜单中复制为路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆