System() with .msi files on WinXP

I have a ruby script that installs several windows applications like
this:

programs.each { |p| system§ }

This works great with .exe installers, but if the program is a .msi
installer, nothing happens and ruby exits with 0.

With Python, os.system(installer.msi) works great. Perhaps in Ruby I
should do this differently? Any suggestions?

Thanks,
Brad

rtilley wrote:

Thanks,
Brad

What about

system “start #{p}”

just a guess…

Joel VanderWerf wrote:

rtilley wrote:

Thanks,
Brad

What about

system “start #{p}”

just a guess…

msiexec /? and see MSDN

Use “msiexec”

Make sure you pass the right switches for a silent install.

end

system on windows is problematic! I think this is more of a
windows issue than a ruby issue as I have the same problem
with python and ruby when working with system.

Try working backwards - install the .msi manually using msiexec.exe
file.msi at the command line. Once you know it works, create
a
script that just calls system(‘what_worked_above’).

Does that work?

Then, once you know what works with MSI, build that into the script. If
it
doesn’t work with the one-line system() script, then I’m not sure what
to
suggest.

-M

Mike wrote:

end
Does that work?
Sort of…

‘msiexec -i installer.msi’ from a cmd prompt translates to this in Ruby:

Works in Ruby:

system(‘msiexec -i installer.msi’)

This works fine. But string interpolation does not work, and it should,
right?

Fails in Ruby:

system(‘msiexec -i #{File.basename(wup)}’)

rtilley wrote:

Fails in Ruby:

system(‘msiexec -i #{File.basename(wup)}’)

Interpolation only happens in double quotes. Try:

system(“msiexec -i #{File.basename(wup)}”)

Miles Monroe wrote:

just a guess…

msiexec /? and see MSDN

I’ve tried that and start… still no go. Here’s the code:

def install_programs(program_list)
#program_list is a list of absolute paths.
program_list.each do |wup|
Dir.chdir(File.dirname(wup))
puts Dir.getwd
puts(File.basename(wup))
system(‘msiexec -i #{File.basename(wup)}’)
end
end

system on windows is problematic! I think this is more of a windows
issue than a ruby issue as I have the same problem with python and ruby
when working with system.