Vibha Vibha - 6 months ago 30
Ruby Question

Call Ruby from a VBScript

Hey I have been working with

lately. There is a scenario where I need to call a ruby script from another
and I am stuck there. I tried this code,

Set newobj = CreateObject("")
obj = newobj.Run("ruby E:\rubyfile.rb > D:\newdoc.txt",1,true)

but the ruby script is not giving the result. Am I doing it right or is there some other way to do it?
If the ruby script is executed separately then the results are generated, so the problem is not with the ruby script.


You need a shell (%comspec% /c) to get a shell's feature like > redirection. So change

obj = newobj.Run("ruby E:\rubyfile.rb > D:\newdoc.txt",1,true)


nRet = newobj.Run("%comspec% /c ruby E:\rubyfile.rb > D:\newdoc.txt",1,true)

(Study the docs for .Run to see the reason for nRet instead of obj and spend a thought on the lousy-ness of the name "newobj")