powershell - 如何创建一个简单的 MSI,运行一个带参数的简单 ps1 脚本?

标签 powershell windows-installer

我想将我的 ps1 脚本打包成一个 MSI

the ps1 name apple.ps1, which will input 2 parameters

./apple.ps1 <param1> <param2>

How can i make an msi package to run the apple.ps1?

在那个msi包中,有一个选项让我输入两个参数

是否有任何教程或简单的方法来做到这一点?

最佳答案

您可以使用自定义操作调用 PowerShell 脚本。以下是如何使用 Wix 执行此操作的示例:

http://damienbod.wordpress.com/2013/09/01/wix-installer-with-powershell-scripts/

命令行参数在命令行末尾以语法形式 NAME=VALUE 自动收集。有关示例,请参见 msiexec.exe/h。

使用属性值取决于您用来制作 MSI 的工具。这篇文章可能有助于展示如何在 Visual Studio 的安装程序编辑器中使用它们。

http://www.codeproject.com/Articles/16767/How-to-Pass-Command-Line-Arguments-to-MSI-Installe

关于powershell - 如何创建一个简单的 MSI,运行一个带参数的简单 ps1 脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19762867/

相关文章:

windows-installer - 使用更新安装程序 MSP 删除文件

xml - Wix 安装程序错误 2343

c# - INSTALLLEVEL 不安装功能

powershell - 如何在Windows 8上安装最新的Powershell?

python - 如何检测我的 python 代码是否在 PowerShell 或命令提示符 (cmd) 中运行

sharepoint - 在SharePoint中集成PowerShell

service - 没有足够的权限来安装服务

c# - 安装 msi 后运行 exe,我看到启动复选框,但应用程序未运行

c# - 我如何对这个自定义 commandlet 进行单元测试

powershell - 控制 Powershell 控制台的窗口位置