Pascal Scripting: Exec

Prototype:

function Exec(const Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ResultCode: Integer): Boolean;

Description:

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.

Remarks:

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.

Example:
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;
See also:

ExecAsOriginalUser

如何在 Inno Setup 中执行命令行的命令的更多相关文章

  1. 如何在 Inno Setup 中关联多种文件格式

    问题描述 Inno Setup 是一款十分强大的 Windows 安装程序制作软件,可以通过编写并编译 iss 脚本来创建安装包.之前都是直接将 Pyinstaller 生成的文件夹压缩为 zip 格 ...

  2. Inno setup 中 执行参数传递注意的地方

    Inno setup编译器编译使用pascal脚本编写的打包代码,其中Run段可以执行某些特定的程序,遇到一个bat批处理文件传递参数的问题,记录如下 1: [Run] 2: Filename: &q ...

  3. 在Unicode版Inno Setup中使用ISSkin给安装程序添加皮肤

    原文 http://www.cnblogs.com/2356/archive/2009/10/27/1590565.html 在Unicode版Inno Setup中使用ISSkin给安装程序添加皮肤 ...

  4. Oozie命令行常用命令汇总[转]

    Oozie命令行常用命令汇总 有时候脚本跑多了就不愿意在OozieWeb端去看脚本的运行情况了.还好Oozie提供了很多命令行命令.能通过命令行直接检索自己想看到的脚本信息.在这里简单进行一下总结.一 ...

  5. Linux命令行与命令

    Linux命令行与命令   作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! Linux的命令是很重要的工具,也往往是初学者最大的瓶 ...

  6. 命令行工具命令 - run包到手机里

    命令行工具命令 你完全可以选择不输入以下这些命令,执行这些命令的结果与在 Android Studio 中单击"运行"按钮是一样的. chmod +x gradlew - 此命令只 ...

  7. Windows命令行(DOS命令)教程 -1 (转载) http://www.pconline.com.cn/pcedu/rookie/basic/10111/15325.html

    一.命令行简介 命令行就是在Windows操作系统中打开DOS窗口,以字符串的形式执行Windows管理程序. 在这里,先解释什么是DOS? DOS--Disk Operation System 磁盘 ...

  8. Windows命令行(DOS命令)教程

    一.命令行简介 命令行就是在Windows操作系统中打开DOS窗口,以字符串的形式执行Windows管理程序. 在这里,先解释什么是DOS? DOS——Disk Operation System 磁盘 ...

  9. 【Linux】1、命令行及命令参数

    命令行及命令参数 文章目录 命令行及命令参数 1.命令行提示符 2.命令和命令参数 简单的命令 date ls 命令参数 短参数(一个字母) 长参数(多个字母) 参数的值 其它参数 3.小结 4.参考 ...

随机推荐

  1. Python Tkinter Grid布局管理器详解

    Grid(网格)布局管理器会将控件放置到一个二维的表格里.主控件被分割成一系列的行和列,表格中的每个单元(cell)都可以放置一个控件. 注意:不要试图在一个主窗口中混合使用pack和grid (1) ...

  2. 【cs224w】Lecture 4 - 社区结构

    Community 转自本人:https://blog.csdn.net/New2World/article/details/105328390 之前讲到了网络中节点扮演不同角色,而角色这个概念和社区 ...

  3. Aho-Corasick automaton

    目录 KMP 算法 BF 算法 KMP 算法 避免重复遍历 算法思想 代码实现 匹配函数 求 next 数组 字典树 多模匹配 构造字典树 字典树的结构体定义 构造算法 伪代码 代码实现 失配指针 功 ...

  4. Unity 游戏框架搭建 2019 (二十五) 类的第一个作用 与 Obselete 属性

    在上一篇我们整理到了第七个示例,我们今天再接着往下整理.我们来看第八个示例: #if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; ...

  5. IP和端口查询

  6. 用最新的版本,蹦最野的迪~~~IDE写大数据程序避坑指南

    文章更新于:2020-04-05 注:本次实验使用的操作系统及各个程序版本号 类别 版本号 说明 操作系统 Ubuntu 16.04.6 LTS 代号 xenial jdk java version ...

  7. docker开机自动启动

    方法一: chkconfig docker on 方法二: 1.1是用systemctl: systemctl enable docker 1.2将Docker的docker.service服务移动到 ...

  8. javascript入门 之 bind() (二)

    <!DOCTYPE html> <HTML> <HEAD> <script type="text/javascript" src=&quo ...

  9. matplotlib 中其他基于Affine2DBase的类

    2020-04-11 11:42:22 --Edit by yangray以下所有类(除了BboxTransformToMaxOnly )都直接继承于Affine2DBaseIdentityTrans ...

  10. Powershell 输出信息过多,结尾显示省略号

    有时候我们通过powershell指令去查询某些信息时,因为输出结果过多,导致一部分重要信息被省略号代替,如下图 面对这种情况无论是 |fl 还是  out-file 亦或是 export-csv都无 ...