Share via


Using msexec in batch file

Question

Wednesday, October 16, 2019 4:19 PM

Hello Guys,

Can you please help me with a batch file to silently install a msi application.

Here's my command

msiexec /i "C:\Users\Test\Desktop\Toad\toad.msi" INSTALLDIR="C:\Toad\" /q

Thank you very much

Regards, Prasad

All replies (7)

Wednesday, October 16, 2019 5:10 PM âś…Answered

You can use the runas, but it would be better to run it with PowerShell as it can handle the credentials better.

How can I call a PowerShell script as a particular user from the Windows command prompt?

How to run batch file command with elevated permissions?

Blog: https://thesystemcenterblog.com LinkedIn:


Wednesday, October 16, 2019 4:30 PM

Hi,

What is your issue? Use the msiexec /? to get help, it offers quite a good explanation of all the switches.

To install an MSI completely silently via the command line, use the following:

msiexec.exe /i "C:\Users\Test\Desktop\Toad\toad.msi" INSTALLDIR="C:\Toad\" /qn

/q - sets the interface level

/n - no UI

Best regards,
Leon

Blog: https://thesystemcenterblog.com LinkedIn:


Wednesday, October 16, 2019 4:32 PM

I need to deploy this .bat file to users, when i added this command line in a .bat file and executed it. It won't install the package.

But when i type the same in the cmd it does.

Anything i am missing here?

Regards, Prasad


Wednesday, October 16, 2019 4:46 PM

The command should work by simply inserting it in a batch file (for example InstallToad.bat).

How are you running the batch file?

Blog: https://thesystemcenterblog.com LinkedIn:


Wednesday, October 16, 2019 4:55 PM

exactly.

i created a file toad.bat, with below:

msiexec /i "C:\Users\Test\Desktop\Toad\toad.msi" INSTALLDIR="C:\Toad\" /q

and saved it on my desktop

double clicked on it.

it does nothing

Regards, Prasad


Wednesday, October 16, 2019 4:59 PM

You'll probably have to run it as administrator.

Blog: https://thesystemcenterblog.com LinkedIn:


Wednesday, October 16, 2019 5:01 PM

so, if i have to deploy it using sccm to bunch of machines.

do i need to use any other switch to run as administrator?

Regards, Prasad