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

查看:376
本文介绍了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,并启动与之关联的可执行文件. verb选项可用于控制对文件执行的操作.它利用 Windows ShellExecute API .

参考文献:
查看全文

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