msiexec
Provides the means to install, modify, and perform operations on Windows Installer from the command line.
Install options
Set the install type for launching an installation package.
Syntax
msiexec.exe [/i][/a][/j][/x]
Parameters
Parameter | Description |
---|---|
/i | Specifies normal installation. |
/a | Specifies administrative installation. |
/ju | Advertise the product to the current user. |
/jm | Advertise the product to all users. |
/j/g | Specifies the language identifier used by the advertised package. |
/j/t | Applies transform to the advertised package. |
/x | Uninstalls the package. |
Specifies the location and name of the installation package file. |
Examples
To install a package named example.msi from the C: drive, using a normal installation process, type:
msiexec.exe /i "C:\example.msi"
Display options
You can configure what a user sees during the installation process, based on your target environment. For example, if you’re distributing a package to all clients for manual installation, there should be a full UI. However, if you’re deploying a package using Group Policy, which requires no user interaction, there should be no UI involved.
Syntax
msiexec.exe /i [/quiet][/passive][/q]
Parameters
Parameter | Description |
---|---|
Specifies the location and name of the installation package file. | |
/quiet | Specifies quiet mode, which means there’s no user interaction required. |
/passive | Specifies unattended mode, which means the installation only shows a progress bar. |
/qn | Specifies there’s no UI during the installation process. |
/qn+ | Specifies there’s no UI during the installation process, except for a final dialog box at the end. |
/qb | Specifies there’s a basic UI during the installation process. |
/qb+ | Specifies there’s a basic UI during the installation process, including a final dialog box at the end. |
/qr | Specifies a reduced UI experience during the installation process. |
/qf | Specifies a full UI experience during the installation process. |
Remarks
- The modal box isn’t shown if the installation is cancelled by the user. You can use qb+! or qb!+ to hide the CANCEL button.
Examples
To install package C:\example.msi, using a normal installation process and no UI, type:
msiexec.exe /i "C:\example.msi" /qn
Restart options
If your installation package overwrites files or attempts to change files that are in use, a reboot might be required before the installation completes.
Syntax
msiexec.exe /i [/norestart][/promptrestart][/forcerestart]
Parameters
Parameter | Description |
---|---|
Specifies the location and name of the installation package file. | |
/norestart | Stops the device from restarting after the installation completes. |
/promptrestart | Prompts the user if a reboot is required. |
/forcerestart | Restarts the device after the installation completes. |
Examples
To install package C:\example.msi, using a normal installation process with no reboot at the end, type:
msiexec.exe /i "C:\example.msi" /norestart
Logging options
If you need to debug your installation package, you can set the parameters to create a log file with specific information.
Syntax
msiexec.exe [/i][/x] [/L]
Parameters
Parameter | Description |
---|---|
/i | Specifies normal installation. |
/x | Uninstalls the package. |
Specifies the location and name of the installation package file. | |
/li | Turns on logging and includes status messages in the output log file. |
/lw | Turns on logging and includes non-fatal warnings in the output log file. |
/le | Turns on logging and includes all error messages in the output log file. |
/la | Turns on logging and includes information about when an action started in the output log file. |
/lr | Turns on logging and includes action-specific records in the output log file. |
/lu | Turns on logging and includes user request information in the output log file. |
/lc | Turns on logging and includes the initial UI parameters in the output log file. |
/lm | Turns on logging and includes out-of-memory or fatal exit information in the output log file. |
/lo | Turns on logging and includes out-of-disk-space messages in the output log file. |
/lp | Turns on logging and includes terminal properties in the output log file. |
/lv | Turns on logging and includes verbose output in the output log file. |
/lx | Turns on logging and includes extra debugging information in the output log file. |
/l+ | Turns on logging and appends the information to an existing log file. |
/l! | Turns on logging and flushes each line to the log file. |
/l* | Turns on logging and logs all information, except verbose information (/lv) or extra debugging information (/lx). |
Specifies the location and name for the output log file. |
Examples
To install package C:\example.msi, using a normal installation process with all logging information provided, including verbose output, and storing the output log file at C:\package.log, type:
msiexec.exe /i "C:\example.msi" /L*V "C:\package.log"
Update options
You can apply or remove updates using an installation package.
Syntax
msiexec.exe [/p][/update][/uninstall[/package]]
Parameters
Parameter | Description |
---|---|
/p | Installs a patch. If you’re installing silently, you must also set the REINSTALLMODE property to ecmus and REINSTALL to ALL. Otherwise, the patch only updates the MSI cached on the target device. |
/update | Install patches option. If you’re applying multiple updates, you must separate them using a semi-colon (;). |
/package | Installs or configures a product. |
Examples
msiexec.exe /p "C:\MyPatch.msp" msiexec.exe /p "C:\MyPatch.msp" /qb REINSTALLMODE="ecmus" REINSTALL="ALL" msiexec.exe /update "C:\MyPatch.msp"
msiexec.exe /uninstall /package
Where the first GUID is the patch GUID, and the second one is the MSI product code to which the patch was applied.
Repair options
You can use this command to repair an installed package.
Syntax
msiexec.exe [/f]
Parameters
Parameter | Description |
---|---|
/fp | Repairs the package if a file is missing. |
/fo | Repairs the package if a file is missing, or if an older version is installed. |
/fe | Repairs the package if file is missing, or if an equal or older version is installed. |
/fd | Repairs the package if file is missing, or if a different version is installed. |
/fc | Repairs the package if file is missing, or if checksum does not match the calculated value. |
/fa | Forces all files to be reinstalled. |
/fu | Repairs all the required user-specific registry entries. |
/fm | Repairs all the required computer-specific registry entries. |
/fs | Repairs all existing shortcuts. |
/fv | Runs from source and re-caches the local package. |
Examples
To force all files to be reinstalled based on the MSI product code to be repaired, , type:
msiexec.exe /fa
Set public properties
You can set public properties through this command. For information about the available properties and how to set them, see Public Properties.
Related links
- Command-Line Syntax Key
- Msiexec.exe Command-Line Options
- Standard Installer Command-Line Options
Команда install (winget)
Команда install программы winget устанавливает указанное приложение. Чтобы указать приложение, которое нужно установить, используйте команду search.
Для команды install необходимо указать точную строку для установки. В случае какой-либо неоднозначности вам будет предложено дополнительно отфильтровать команду install для уточнения приложения.
Использование
Aliases
Для этой команды доступны следующие псевдонимы:
Аргументы
Доступные аргументы перечислены ниже.
Аргумент | Description |
---|---|
-q,—query | Запрос, используемый для поиска приложения. |
Аргумент запроса является позиционным. Синтаксис с использованием подстановочных знаков не поддерживается. Чаще всего это строка символов, которая должна уникальным образом идентифицировать пакет, который вы хотите установить.
Параметры
Эти параметры позволяют настроить функцию установки в соответствии со своими потребностями.
Вариант | Description |
---|---|
-m, —manifest | За этим параметром должен следовать путь к файлу манифеста (YAML). Манифест можно использовать для запуска функции установки из локального файла YAML. |
—id | Ограничивает установку приложением с определенным идентификатором. |
—name | Ограничивает поиск приложением с определенным именем. |
—moniker | Ограничивает поиск моникером, указанным для приложения. |
-v, —version | Позволяет указать точную версию для установки. Если параметр не задан, будет установлено приложение с наибольшим номером версии. |
-s, —source | Ограничивает поиск источником с указанным именем. За этим параметром должно следовать имя источника. |
—scope | Позволяет указать, должен ли установщик использовать область пользователя или компьютера. Ознакомьтесь с известными проблемами, связанными с областью установки пакета. |
-a, —architecture | Выбор архитектуры для установки. |
-e, —exact | Ищет точное совпадение со строкой в запросе, выполняя при этом проверку на учет регистра. Поведение по умолчанию для подстроки не используется. |
-i, —interactive | Запускает установщик в интерактивном режиме. При взаимодействии по умолчанию отображается ход выполнения установщика. |
-h, —silent | Запускает установщик в автоматическом режиме. Блокирует весь пользовательский интерфейс. При взаимодействии по умолчанию отображается ход выполнения установщика. |
—locale | Указывает используемый языковой стандарт (формат BCP47). |
-o, —log | Направляет данные журнала в файл журнала. Необходимо указать путь к файлу, для которого у вас есть права на запись. |
—Пользовательские | Аргументы, передаваемые установщику в дополнение к значениям по умолчанию. |
—override | Строка, которая будет передана непосредственно в установщик. |
-l, —location | Расположение для установки (если поддерживается). |
—ignore-security-hash | Пропустить сбой проверки хэша установщика. Не рекомендуется. |
—ignore-local-archive-malware-scan | Игнорировать сканирование вредоносных программ, выполняемое в рамках установки пакета типа архива из локального манифеста. |
—dependency-source | Найдите зависимости пакета с помощью указанного источника. |
—accept-package-agreements | Используется для принятия лицензионного соглашения и позволяет избежать появления запроса. |
—accept-source-agreements | Используется для принятия исходного лицензионного соглашения и позволяет избежать появления запроса. |
—no-upgrade | Пропускает обновление, если установленная версия уже существует. |
—header | Необязательный заголовок HTTP источника REST Windows-Package-Manager. |
-r, —rename | Значение для переименования исполняемого файла (переносимый) |
—uninstall-previous | Удаление предыдущей версии пакета во время обновления |
—force | Прямо выполните команду и продолжайте работу с проблемами, связанными с безопасностью. |
-?, —help | Позволяет получит дополнительную справку по этой команде. |
—Подожди | Предложит пользователю нажать любой ключ перед выходом. |
—logs,—open-logs | Откройте расположение журналов по умолчанию. |
—verbose, —verbose-logs | Используется для переопределения параметра ведения журнала и создания подробного журнала. |
—disable-interactivity | Отключите интерактивные запросы. |
Примеры запросов
В следующем примере устанавливается определенная версия приложения.
winget install powertoys --version 0.15.2
В следующем примере выполняется установка приложения по его идентификатору.
winget install --id Microsoft.PowerToys
В следующем примере выполняется установка приложения по версии и идентификатору.
winget install --id Microsoft.PowerToys --version 0.15.2
Множественный выбор
Если по запросу, отправленному программе winget, найдено несколько приложений, winget отобразит результаты поиска. Это даст вам дополнительные данные, необходимые для уточнения условий поиска и правильной установки.
Лучший способ ограничить выбор одним файлом — использовать идентификатор приложения в сочетании с параметром точного запроса. Например:
winget install --id Git.Git -e
Если настроено несколько источников, возможно наличие повторяющихся записей. Чтобы устранить неоднозначность, необходимо указать источник.
winget install --id Git.Git -e --source winget
Источник msstore использует уникальные идентификаторы в качестве значения Id для пакетов. Для них не требуется параметр запроса exact. Например:
winget install XP9KHM4BK9FZ7Q -s msstore
Локальная установка
Параметр manifest позволяет установить приложение, передавая YAML-файл непосредственно клиенту. Если манифест содержит несколько файлов, необходимо использовать каталог, содержащий эти файлы. Параметр manifest используется следующим образом.
Использование: winget install —manifest \
Вариант | Description |
---|---|
-m, —manifest | Путь к манифестам устанавливаемого приложения. |
Установка пакетов из локальных файлов манифеста может быть связана с определенными рисками. Администратор должен включить эту функцию в качестве дополнительной меры предосторожности. Чтобы включить эту функцию, выполните winget settings —enable LocalManifestFiles . Чтобы отключить эту функцию, выполните winget settings —disable LocalManifestFiles .
Файлы журналов
Если файлы журналов для winget не перенаправлены, они будут находиться в следующей папке: %temp%\AICLI\*.log
Лицензионные соглашения
Некоторые приложения в начале установке потребуют от пользователя принять условия лицензии или других соглашений, прежде чем установка будет продолжена. В этом случае Диспетчер пакетов Windows предложит пользователю принять условия соглашений. Если пользователь не примет условия, приложение не будет установлено.
В командной строке можно включить автоматическое принятие условий соглашений, передав в командной строке параметр —accept-package-agreements. Это может быть полезно при создании скрипта для Диспетчера пакетов Windows.
Статьи по теме
При подготовке материала использовались источники:
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/msiexec
https://learn.microsoft.com/ru-ru/windows/package-manager/winget/install