From: Ralph Shnelvar on 22 Jul 2010 14:21 RĂ©mi, Thursday, July 22, 2010, 3:37:50 AM, you wrote: RC> Hi Clifford Heath & Roger Pack, RC> thanks for you answers. RC> I don't understand wath you say, perhaps I didn't explain my problem RC> correctly. RC> I want to avoid that system() call cmd.exe RC> in : RC> system( [cmd, cmd], "-background", "#000000", "-geometry", "100%%" RC> cmd is a String : RC> cmd = "d:\\mes documents\\___3D\\imageMagick\\montage.exe" RC> not the cmd.exe shell 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 ? 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`
From: Roger Pack on 22 Jul 2010 15:37 > 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/.
From: adam hegge on 22 Jul 2010 16:02 [Note: parts of this message were removed to make it a legal post.] 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 <rogerpack2005(a)gmail.com> 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/. > >
First
|
Prev
|
Pages: 1 2 Prev: Wsdl - Webservice Client Next: Simple Hack To Get $2500 To Your PayPal Account. |