From: adam hegge Date: 2010-07-23T05:02:20+09:00 Subject: Re: How to avoid black-windows using system() ? --0016362837963d6602048bff656c Content-Type: text/plain; charset=ISO-8859-1 require 'win32/process' Process.create({:app_name => cmd, :startup_info=> {:sw_flags=>Process::SW_HIDE , :startf_flags => Process::STARTF_USESHOWWINDOW}}) On Thu, Jul 22, 2010 at 3:37 PM, Roger Pack wrote: > > > RC> I thought that when you call system() with only one parameter, > > cmd.exe > > RC> is used but when you call system() with more than one parameter, the > > RC> program is directly launched without cmd.exe > > > > RC> Can you confirm that ? > > > I think I know where the confusion lies. > from [1] it reads > > " If exec is given a single argument, that argument is taken as a line > that is subject to shell expansion before being executed. If multiple > arguments are given, the second and subsequent arguments are passed as > parameters to command with no shell expansion" > > The shell expansion it is referring to here is things like expanding > paths, ex: > system("ls $HOME") gets expanded to system("ls /home/username") > > however > > system("ls", "$HOME") > > does not get auto-expanded. > > They both require "sub-shell" in windows because the process you are > executing (montage.exe) requires somewhere to output its data to, so it > pops up. It is possible to make a program "not require an output shell" > but most programs aren't setup that way (rubyw.exe is, ruby.exe isn't, > for example). > > Recommendation: use IO.popen("whatever").read to avoid popping it up. > GL. > -r > > > > [1] http://ruby-doc.org/core/classes/Kernel.html#M005968 > > > > > RC> thanks & regards. > > > > I'm not sure I follow you ... > > > > Have you tried the "back tick" processing to do what you want? > > `d:/mes documents/___3D/imageMagick/montage.exe` > > -- > Posted via http://www.ruby-forum.com/. > > --0016362837963d6602048bff656c--