[英]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
注册到文件类型:
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
)。 HKEY_CLASSES_ROOT\\<your_value>
and add new subKey with your name (I added ScriptOpen
). HKEY_CLASSES_ROOT\\<your_value>
并添加带有您名字的新subKey(我添加了ScriptOpen
)。 command
with Default parameter as "<path_to_your_exe> "%1""
. 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.