简体   繁体   English

从Windows资源管理器的文件上下文菜单中执行AutoIt脚本

[英]Executing an AutoIt script from Windows Explorer's file context menu

How to make an AutoIt script run as a file verb? 如何使AutoIt脚本作为文件动词运行? For eg WinRAR we can right click and compress selected file (or other stuff). 对于例如WinRAR,我们可以右键单击并压缩所选文件(或其他内容)。 How can I make an AutoIt script appear in Windows Explorer's file context menu like that? 如何使AutoIt脚本出现在Windows资源管理器的文件上下文菜单中?

You can register your script's .exe in context menu to a file type: 您可以在上下文菜单中将脚本的.exe注册到文件类型:

  1. Open regedit.exe and find your file type in HKEY_CLASSES_ROOT (for example .rar ). 打开regedit.exe并在HKEY_CLASSES_ROOT找到您的文件类型(例如.rar )。 Get the value from there (mine was 7-Zip.rar ). 从那里获得价值(我的是7-Zip.rar )。
  2. Go to HKEY_CLASSES_ROOT\\<your_value> and add new subKey with your name (I added ScriptOpen ). 转到HKEY_CLASSES_ROOT\\<your_value>并添加带有您名字的新subKey(我添加了ScriptOpen )。
  3. Add subKey command with Default parameter as "<path_to_your_exe> "%1"" . 使用Default参数添加subKey command"<path_to_your_exe> "%1""

Here is an example of how to do it from your script (compiled to .exe): 以下是如何从脚本(编译为.exe)执行此操作的示例:

RegWrite("HKEY_CLASSES_ROOT\7-Zip.rar\shell\ScriptOpen")
RegWrite("HKEY_CLASSES_ROOT\7-Zip.rar\shell\ScriptOpen", "", "REG_SZ", "Open with my script")
RegWrite("HKEY_CLASSES_ROOT\7-Zip.rar\shell\ScriptOpen\command")
RegWrite("HKEY_CLASSES_ROOT\7-Zip.rar\shell\ScriptOpen\command", "", "REG_SZ", """" & @AutoItExe & """ ""%1""")

Check out these functions: 看看这些功能:

  • _ShellFile()
    Create an entry in the shell contextmenu when selecting an assigned filetype. 选择指定的文件类型时,在shell上下文菜单中创建一个条目。 Includes the program icon as well. 还包括程序图标。

  • _ShellFolder()
    Create an entry in the shell contextmenu when selecting a folder. 选择文件夹时,在shell上下文菜单中创建一个条目。 Includes the program icon as well. 还包括程序图标。

  • _ContextMenu()
    Create an entry in the desktop contextmenu, with the program icon as well. 在桌面上下文菜单中创建一个条目,同时显示程序图标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在VS解决方案文件的Windows资源管理器的上下文菜单中“构建”项目? - How to "Build” item in Windows Explorer's context menu of a VS solution file? c#从上下文菜单Windows资源管理器中的选定文件/文件夹中检索文件/文件夹路径 - c# retrieve file/folder path from selected file/folder in Context Menu Windows Explorer 从命令提示符执行AutoIt脚本 - Executing AutoIt script from command prompt 在 Windows Explorer 上下文菜单中订购 - Order in the Windows Explorer context menu 通过 Windows 10 文件资源管理器中的上下文菜单水平翻转 - Flip Horizontally Through the Context Menu in the Windows 10 File Explorer Windows资源管理器上下文菜单集成,获取右键单击的文件 - Windows Explorer Context Menu Integration, get file that was right clicked on 在Windows资源管理器上下文菜单中添加分隔符(不在子菜单中) - Add a separator in the Windows Explorer context menu (not in a submenu) 涵盖Windows资源管理器上下文菜单应用程序! - Getting Coverage for Windows Explorer Context Menu Application! Eclipse 插件显示 Windows 资源管理器上下文菜单 - Eclipse Plugin to show Windows Explorer context menu Windows资源管理器上下文菜单上的InfoTip - InfoTip on Windows explorer context menu item
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM