uninstall.exe an install leaves behind, is the same runtime with a different payload, so they share one set of command-line flags. Flags are case-insensitive. This page lists all of them.
Setup files and uninstall.exe are windowed programs, so a shell does not wait for them and does not set an exit code. To wait and read the exit code, use Start-Process:
start /wait "" Hello-Setup-1.4.0.exe --silent and read %ERRORLEVEL%. PowerShell needs the .\ in front of a file in the current folder. See Silent installs.
How the command line is read
A value can follow a flag after a space or be attached with an equals sign:--dir "D:\My Apps\Hello" and --dir="D:\My Apps\Hello" are the same, and every flag also works with a slash, like /DIR=D:\Apps\Hello. Flag names ignore case. --with and --without can be given several times and add up. Any other flag given twice keeps its last value.
A mistake is never guessed at. These all stop setup before anything is installed, with exit code 2 and a sentence that names the flag:
- an unknown flag, such as the typo
--silnet, or a stray word - a flag that needs a value and gets none, or gets another flag (
--dir --silent) - a value on a flag that takes none (
--silent=yes) - a
--themethat is notlight,darkorsystem, a--stylethat is not a built-in style or comes without--preview, and a--wait-forthat is not a number
--help works whatever else is on the line.
Install flags
Option names for --with and --without
Names are case-insensitive, and only options the install page would offer have an effect.
Uninstall flags
Run them on theuninstall.exe in the install folder:
With no flags, running
uninstall.exe opens the removal window. It first copies itself to the temp folder and exits, because a running program cannot delete its own file. A machine-wide app’s uninstaller asks for administrator rights first, runs elevated and removes from where it is instead.
Update flags
Available on an installeduninstall.exe when the app has an [updates] section:
A protected app’s update runs read the key kept at install time.
--key-file FILE or BACH_ACCESS_KEY give one yourself. Every update run writes %TEMP%\<app id>-update.log. See Updates for how to use them from your app.
Preview flags
The preview flags are used bybach preview and in Bach’s own development. They show the window with every step pretended:
See Silent installs for examples.