From: Luis Lavena Date: 2010-11-23T21:40:22+09:00 Subject: Re: system() or process.create? On Nov 23, 12:08 am, Fengfeng Li wrote: > Hi everyone, > > I'm a beginer of ruby, I want to know how to call external applications > in ruby, without the cmd window poping up. > I leanrt this link:http://www.ruby-forum.com/topic/213521#new, and > tried all the below ways: > result = `#{cmd}` #I tried this but the window still poped up > result = IO.popen("#{cmd}").read   #and the same with this one > Process.create( >   :app_name => cmd, >   :startup_info=>  {:sw_flags=>Process::SW_HIDE , :startf_flags => > Process::STARTF_USESHOWWINDOW}                    ) > #at last, I use process.create and the black window disappeared. > > It worked good when I set cmd as "\"#{winrar_path}\\winrar.exe\" e -y > -o+ -ibck \"#{para[:dst_path]}\\*.zip\" \"#{para[:dst_path]}\\\"", but > when I changed it to "del *.zip", it always said "CreateProcess() > failed: ", as below: > WinRAR will pop up a Windows during extraction. You need a command line version tool like 7-zip (7za) that works in the command line and can be hidden or look in WinRAR documentation about silent command line extraction arguments. -- Luis Lavena