Run() 和 ShellExecute() 的区别 [英] Difference between Run() and ShellExecute()

查看:40
本文介绍了Run() 和 ShellExecute() 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 AutoIt 在 Windows 的 shell/终端中执行某些操作.我知道有两种方法可以做到.例如:

I want to execute something in a shell/terminal on Windows via AutoIt. And I know that there are two ways of doing it. For example:

Run(@ComSpec & " /c " & $myCommand, "", @SW_HIDE)
;and
ShellExecute($myCommand)

我不明白其中的区别;这两个函数都会做我想要的,但它们背后是什么?它们有哪些优点和缺点?

I don't understand the difference; both functions will do what I want, but what's behind them? Which pros and cons do they have?

推荐答案

Run() 仅用于触发可执行文件.它需要程序的完整路径.

Run() is used to fire off executable files only. It requires the full path of the program.

ShellExecute() 也接受 .txt、.htm 和 .docx 等内容文件,并将启动与之关联的可执行文件.动词选项可用于控制对文件执行的操作.它利用了 Windows ShellExecute API.

参考文献:
AutoIt Wiki - 常见问题 - 如何运行非 exe 文件…

这篇关于Run() 和 ShellExecute() 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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