在 PowerShell 中安装 MSI 文件

Migel Hewage Nimesha 2023年1月30日 2022年5月16日
  1. 在 PowerShell 中安装 MSI 文件
  2. 在 PowerShell 中通过调用路径和文件来调用 .msi 文件
在 PowerShell 中安装 MSI 文件

PowerShell 是一种 Microsoft 工具,可用于 Windows、Linux 和 Mac 用户的脚本编写。不同的运算符有不同版本的 PowerShell。

对于 Windows 用户,在 Windows XP 以上的 Windows 操作系统中,默认安装 PowerShell。但是,如果需要,其他用户可以从 Microsoft 站点下载适用于 PowerShell 的应用程序。

专业人员可以通过使用 PowerShell 工具来实现高级脚本编写目的。这些可以用作自动化工具和基于 CI\CD 的系统的配置管理。

在 PowerShell 中安装 MSI 文件

本文将讨论使用 PowerShell 应用程序脚本平台安装其他应用程序。PowerShell 支持不同的操作系统用途,包括通过调用文件和函数作为跨平台应用程序来安装 .exe 和其他类似应用程序。

MSI 是 Windows 的一种 Microsoft 安装包文件格式,源自 Microsoft Installer。与 .exe 文件格式类似,.msi 是用于安装存储和卸载程序的支持文件类型。

.exe 文件类似,.msi 文件也可以通过 PowerShell 执行。用户可以在 PowerShell 脚本中使用几种不同的方法轻松安装 .msi 文件。

在 PowerShell 中通过调用路径和文件来调用 .msi 文件

实现此要求的最简单方法是直接通过 PowerShell 脚本调用文件。以下是用于上述目的的代码。

Start-Process FirefoxSetup14.0.1.msi

以下是执行的屏幕截图,输出为 Firefox 的 .msi 文件用于安装。

powershell 安装 msi

还有其他方法,如 msiexecinstall-package 等。这些方法可用于安装或 .msi 执行过程。

Migel Hewage Nimesha avatar Migel Hewage Nimesha avatar

Nimesha is a Full-stack Software Engineer for more than five years, he loves technology, as technology has the power to solve our many problems within just a minute. He have been contributing to various projects over the last 5+ years and working with almost all the so-called 03 tiers(DB, M-Tier, and Client). Recently, he has started working with DevOps technologies such as Azure administration, Kubernetes, Terraform automation, and Bash scripting as well.