From: Toshi Date: 2001-12-01T17:29:26+09:00 Subject: [ruby-talk:27165] Re: external commands On Sat, 1 Dec 2001 16:31:02 +0900 Michele De Lorenzi wrote: > If someone had already answered to me, please can you re send you answer > because I loose some e-mails. > Thanks. > On ven, 2001-11-30 at 22:43, michelemdl@libero.it wrote: > > I need to exec an external programm from a ruby script. > > The name of the external command is ALADDIN. > > This is what I do under Linux: > > > > ... > > 'ALADDIN -f inputfile.std > outputfile.std' #line in ruby script to > > call the external program ALADDIN # > > ... > > > > Doing the same under windows doesn' t work. How can I do that under > > windows? I think you should check an environment variable 'COMSPEC'. C:\MyData>type foo.txt beta alpha gamma C:\MyData>set ComSpec ComSpec=C:\WINNT\system32\cmd.exe C:\MyData>irb irb(main):001:0> puts `sort foo.txt` alpha beta gamma nil irb(main):002:0> puts `sort foo.txt > nul` nil irb(main):003:0> exit C:\MyData>set ComSpec=C:\BadPath\Or\Empty\cmd.exe C:\MyData>irb irb(main):001:0> puts `sort foo.txt` alpha beta gamma nil irb(main):002:0> puts `sort foo.txt > nul` Errno::ESRCH: No such process - "sort foo.txt > nul" from (irb):2:in ``' from (irb):2 irb(main):003:0> -- Toshi