Run msiexec without displaying

0

I want to run a msi package from a .cmd file, but I have two drawbacks:

  • This code allows me to install the package msi , but I get the window where it asks me to press the next button and finish , also asks me if I want to run as administrator

    msiexec /i "C:\pruebainstall\setup2.msi"
    
  • Then I run the following code to install the msi package as administrator.

    msiexec /a "C:\pruebainstall\setup2.msi"
    

And with this, the installation assistant shows me and it no longer asks me to run as administrator, but the problem is that I get a message saying that the installer does not have administrator privileges and does not allow me to install.

I would appreciate if you could help me with this code in such a way that when I run the file .cmd I can install without showing the installation wizard and that I do not request installer permissions. Thanks

    
asked by Freddy 24.06.2017 в 06:00
source

2 answers

1

you can use:

msiexec /i /a c:\path\to\package.msi /quiet /qn /norestart

it is called a silent installation.

This will only work if you opened the CMD as an administrator

    
answered by 24.06.2017 / 17:26
source
2

If you want to run as administrator, use the runas 1 command as a prefix before performing the task in the .cmd file you have:

runas /user:Administrator

O /user:Administrador depending on whether your version is in Spanish or English (I think you do not have to see) .

On the same line you add the command to be executed in quotes (Taken from the answer of Francisco Núñez )

"msiexec /i c:\path\to\package.msi /quiet /qn /norestart"

The content of your .cmd file should now be something like this:

runas /user:Administrator "msiexec /i c:\path\to\package.msi /quiet /qn /norestart"

With that should be enough, I leave this answer in related SO.

1 : To use the command, you need to have the administrator account activated and have a version higher than Windows 2000 (According to Wikipedia ) .

    
answered by 24.06.2017 в 17:56