如何在 Inno Setup 中执行命令行的命令
Pascal Scripting: Exec
function Exec(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean;
Executes the specified executable or batch file, using the same credentials as Setup/Uninstall. The Wait parameter specifies whether the function should return immediately or wait until the launched process has terminated or is idle. Returns True if the specified file was executed successfully, False otherwise.
If True is returned and Wait is ewWaitUntilTerminated then ResultCode returns the exit code of the process.
If False is returned then ResultCode specifies the error that occurred. Use SysErrorMessage(ResultCode) to get a description of the error.
TExecWait is defined as:
TExecWait = (ewNoWait, ewWaitUntilTerminated, ewWaitUntilIdle);
Use the ShellExec function instead if you need to launch a file that is not an executable or batch file.
Do not include quotes in the Filename parameter; the function will add them automatically.
The WorkingDir parameter can be an empty string, in which case it will try to extract a pathname from the Filename parameter and use that as the initial current directory for the process. If no pathname was specified in Filename, a default directory will be used.
If you have a single string containing both a filename and parameters (e.g. a command line obtained from an UninstallString registry value), you need not separate them yourself; just pass '>' in the Filename parameter, and the full command line in the Params parameter. (Note that when this is done, the function's special platform-independent support for .bat and .cmd files is disabled; it simply passes the specified command line to CreateProcess without any processing.)
By default, when Setup/Uninstall is running in 64-bit install mode, this function disables WOW64 file system redirection when calling CreateProcess. It is possible to override this by calling EnableFsRedirection.
var
ResultCode: Integer;
begin
// Launch Notepad and wait for it to terminate
if Exec(ExpandConstant('{win}\notepad.exe'), '', '', SW_SHOW,
ewWaitUntilTerminated, ResultCode) then
begin
// handle success if necessary; ResultCode contains the exit code
end
else begin
// handle failure if necessary; ResultCode contains the error code
end;
end;
如何在 Inno Setup 中执行命令行的命令的更多相关文章
- 如何在 Inno Setup 中关联多种文件格式
问题描述 Inno Setup 是一款十分强大的 Windows 安装程序制作软件,可以通过编写并编译 iss 脚本来创建安装包.之前都是直接将 Pyinstaller 生成的文件夹压缩为 zip 格 ...
- Inno setup 中 执行参数传递注意的地方
Inno setup编译器编译使用pascal脚本编写的打包代码,其中Run段可以执行某些特定的程序,遇到一个bat批处理文件传递参数的问题,记录如下 1: [Run] 2: Filename: &q ...
- 在Unicode版Inno Setup中使用ISSkin给安装程序添加皮肤
原文 http://www.cnblogs.com/2356/archive/2009/10/27/1590565.html 在Unicode版Inno Setup中使用ISSkin给安装程序添加皮肤 ...
- Oozie命令行常用命令汇总[转]
Oozie命令行常用命令汇总 有时候脚本跑多了就不愿意在OozieWeb端去看脚本的运行情况了.还好Oozie提供了很多命令行命令.能通过命令行直接检索自己想看到的脚本信息.在这里简单进行一下总结.一 ...
- Linux命令行与命令
Linux命令行与命令 作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! Linux的命令是很重要的工具,也往往是初学者最大的瓶 ...
- 命令行工具命令 - run包到手机里
命令行工具命令 你完全可以选择不输入以下这些命令,执行这些命令的结果与在 Android Studio 中单击"运行"按钮是一样的. chmod +x gradlew - 此命令只 ...
- Windows命令行(DOS命令)教程 -1 (转载) http://www.pconline.com.cn/pcedu/rookie/basic/10111/15325.html
一.命令行简介 命令行就是在Windows操作系统中打开DOS窗口,以字符串的形式执行Windows管理程序. 在这里,先解释什么是DOS? DOS--Disk Operation System 磁盘 ...
- Windows命令行(DOS命令)教程
一.命令行简介 命令行就是在Windows操作系统中打开DOS窗口,以字符串的形式执行Windows管理程序. 在这里,先解释什么是DOS? DOS——Disk Operation System 磁盘 ...
- 【Linux】1、命令行及命令参数
命令行及命令参数 文章目录 命令行及命令参数 1.命令行提示符 2.命令和命令参数 简单的命令 date ls 命令参数 短参数(一个字母) 长参数(多个字母) 参数的值 其它参数 3.小结 4.参考 ...
随机推荐
- Netty为什么不直接用AtomicXXX,而要用AtomicXXXFieldUpdater去更新变量呢?
更多技术分享可关注我 前言 如果仔细阅读过Netty的线程调度模型的源码,或者NIO线程对象及其线程池的创建源码,那么肯定会遇到类似“AtomicIntegerFieldUpdater”的身影,不禁想 ...
- C. Yet Another Walking Robot Round #617 (Div. 3)()(map + 前后相同状态的存储)
C. Yet Another Walking Robot time limit per test 1 second memory limit per test 256 megabytes input ...
- CentOS 编译安装 Emacs 并配置
Linux 中 CentOS 系列一向以稳定为目标,然而也会存在版本太旧的问题,Emacs 就是其中的一个,目前 Emacs 都发行到 25.2 了,而 CentOS 上的 Emacs 版本却还是 2 ...
- 从养孩子谈谈 IO 模型(一)
同步/异步.阻塞/非阻塞 说的是一回事儿吗? 同步/异步.阻塞/非阻塞 你能通俗易懂的讲清楚吗? Java 中的 BIO.NIO.AIO 你了解吗? Socket 编程你还会吗? Linux 操作系统 ...
- Light of future-冲刺Day 1
目录 归属班级 →2019秋福大软件工程实践Z班 作业要求 →团队作业第五次-项目冲刺 团队名称 未来之光 这个作业的目标 第一天的冲刺总结 作业正文 →Light of future-冲刺Day 1 ...
- 软件——Hexo-NexT配置个人博客
一.安装NexT Hexo 安装主题的方式非常简单,只需要将主题文件拷贝至站点目录的 themes 目录下, 然后修改下配置文件即可.具体到 NexT 来说,安装步骤如下. 1.克隆最新版本 在终端窗 ...
- Spring(二):初始值赋值
依赖注入 1.构造器注入 见spring简介最后一大点. 2.Set方式注入 依赖注入:Set注入 依赖:bean对象的创建依赖于容器. 注入:bean对象的所有属性,由容器注入. bean ,里面属 ...
- Fastdfs文件系统扩容
1.简介 FastDFS文件服务器在设计时,为了支持大容量,存储节点(服务器)采用了分卷(或分组)的组织方式.存储系统由一个或多个卷组成,卷与卷之间的文件是相互独立的,所有卷的文件容量累加就是 ...
- 单线程IP扫描解析
扫描代码: private void Button_Click(object sender, RoutedEventArgs e) { a5.Items.Clear(); string str = t ...
- 22.1 Extends 继承的 方法重写、@Override的使用、
/* * 继承中成员方法的特点 * 子类中没有这个方法,调用父类的 * 子类中重写了这个方法,调用子类的 * 方法的重写:在子父类当中,子类的方法和父类的完全一样,子类重写了父类的方法(覆盖),当子类 ...