Recently I had a need to change the installation directory of a program, and I wanted to know how to execute such a function via PowerShell, Python, or any other.
This would be for Windows, for example, when we install via UI it offers us a default installation directory, as in the example below with 7-Zip.

Through the UI we can freely change this directory, but I wanted to know how you can do the same operation from the command line, to change it to something like the example below.

This would be very useful in automation scripts, especially when working with high volumes of machines.
I appreciate any help!
According to 7zip documentation, to install it in a silent mode you can :
For exe installer: Use the "/S" parameter to do a silent installation and the /D="C:\Program Files\7-Zip" parameter to specify the "output directory". These options are case-sensitive.
For msi installer: Use the /q INSTALLDIR="C:\Program Files\7-Zip" parameters.
In the second case it's quite a standard for Windows.