将多个文件传送到单个批处理文件中(使用资源管理器高亮显示) [英] pipe multiple files into a single batch file (using explorer highlight)

查看:92
本文介绍了将多个文件传送到单个批处理文件中(使用资源管理器高亮显示)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户右键单击文件类型时,我已经可以运行一个批处理文件.我如何做到这一点,以便每个突出显示的组仅运行一个实例,并获取所有文件作为参数. 当前,当用户轮换点击"时,每个文件运行一个实例

I can already get a batch file to run when a user right clicks on a file type. How can I make it so that only one instance runs per highlighted group and gets all the files as arguments. Currently it runs single instance per file when a user "shift clicks"

最有可能用更好的方式来表达这个词...您可以了解为什么我在使用谷歌搜索时遇到了麻烦.

there is most likely a better way to word this... you can see why I had trouble googling it.

谢谢

推荐答案

如果创建一个批处理文件并将其放置在桌面上,则可以选择多个文件并将其拖放到该批处理文件上.它们将作为多个参数传递到文件.

If you create a batch file and place it on your desktop, then you can select multiple files and drop them on that batch file. They will get passed as multiple parameters to the file.

例如,假设您将dropped.bat放在桌面上,它看起来像这样:

For example, assume you put dropped.bat on your desktop, and it looks like this:

@echo off
echo %*
pause

现在假设您有三个文件xyz,如果您多次选择了它们并将它们放在dropped.bat上,则会看到一个命令窗口,其中包含以下文本:

Now assuming you had three files x, y and z, if you multiple-selected them and dropped them on dropped.bat, you'd see a command window come up with this text in it:

C:\Users\alavinio\Desktop\x C:\Users\alavinio\Desktop\y C:\Users\alavinio\Desktop\z
Press any key to continue . . .

那是您可以获得的最接近的东西.右键单击并打开语义期望为每个选定的项目启动一个新的可执行文件,通常这些可执行文件会检查自己的另一个实例,如果看到它们,则将参数发送到该现有进程,然后自行终止.实际上,您可以使用任务管理器或Process Explorer观察到这种情况.

That's the closest you can get. The right-click-and-Open semantics expect to start a new executable for each selected item, and typically those executables check for another instance of themselves, and if they see one, send the parameter over there to that existing process, and terminate themselves. You can actually watch that happen with Task Manager or Process Explorer.

这篇关于将多个文件传送到单个批处理文件中(使用资源管理器高亮显示)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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