将所选文件的名称从发送到“发送到” powershell脚本的菜单
我的脚本已经添加到“发送到”菜单中,它要求搜索字符串,然后在该目录中的每个.log和.txt文件搜索字符串中的每个.log和.txt文件。
但是我需要做的是查看我右键单击并收集名称的文件,以便我可以用作唯一要搜索的文件。
因此,如果您可以帮助我抓住文件的名称上,然后“发送到”我的PowerShell脚本。 谢谢
I have a script that I wrote that is added to the "Send To" menu already, and it asks for a search string and then searches every .log and .txt file in that directory for the string.
But what I need it to do is look at the file I am right clicking on and collect the name so I can use it as the only file to search in.
So if you can help me grab the name of the file I am right clicking on, and then "send to" my PowerShell script.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的“ sendto”文件夹中创建快捷方式:
shell:sendto
调用“发送到”菜单项时,系统将所选文件的完整路径附加到命令行。在您的PowerShell脚本中,使用自动
$ args
数组变量以从命令行参数获取文件路径。此演示显示了如何获取所选文件的数量并循环通过路径:
Create a shortcut in your "SendTo" folder:
shell:sendto
When the "Send to" menu item is invoked, the system appends the full paths of the selected files to the commandline. In your PowerShell script, use the automatic
$args
array variable to get the file paths from the commandline arguments.This demo shows how you can get the number of selected files and loop over the paths: