从自定义应用程序的上下文菜单中获取所选文件的路径

huangapple go评论63阅读模式
英文:

Getting the selected files path from a custom application in context menu

问题

I have a scenario where I keep copying a bunch of files to the same folder and if it exists, I rename the original file there and copy the files. I want to automate this process.
我有一个情景,我不断地将一堆文件复制到同一个文件夹,如果已存在,则重命名原文件并复制文件。我想自动化这个过程。

I was checking if I can add a context menu option which shows on right-click in Windows.
我正在检查是否可以添加一个右键单击时显示的上下文菜单选项在Windows中。

I followed a few tutorials which had given me a way to add a program to the context menu by modifying regkeys.
我按照一些教程的步骤,这些教程提供了一种通过修改注册表键来将程序添加到上下文菜单的方法。

But that just starts the program, I wanted to know how to get the paths of the items selected for copy to. Is there a way to achieve this? Or am I going down a wrong path?
但那只是启动程序,我想知道如何获取所选要复制的项目的路径。有没有办法实现这个?或者我走错了路?

I have added this command to the context menu with my program's exe as value.
我已经将这个命令添加到上下文菜单中,并使用我的程序exe作为值。

I want to know how to get the paths of selected items in my program.
我想知道如何在我的程序中获取所选项目的路径。

英文:

I have a scenario where I keep copying a bunch of files to same folder and if it exists, I rename the original file there and copy the files. I want to automate this process.
I was checking if I can add a context menu option which shows on right-click in Windows.
I followed few tutorials which had gave me a way to add a program to the context menu by modifying regkeys.
But that just starts the program, I wanted to know how to get the paths of the items selected for copy to. Is there a way to achieve this? Or am I going down a wrong path?

I have added this command to context menu with my programs exe as value.

从自定义应用程序的上下文菜单中获取所选文件的路径

I want to know how to get the paths of selected items in my program.

从自定义应用程序的上下文菜单中获取所选文件的路径

答案1

得分: 0

"PathToExe.exe" "%1". This passes the selected folder/file full as the first argument.

英文:

I found the answer for this.
When adding regkey for the context menu command specify it as following
"PathToExe.exe""%1". This passes the selected folder/file full as the first argument

huangapple
  • 本文由 发表于 2023年7月18日 15:27:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76710409.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定