且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 VBScript 调用 Ruby

更新时间:2023-12-05 14:00:28

你需要一个 shell (%comspec%/c) 来获得一个 shell 的功能,比如 >重定向.所以改变

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)

(研究 .Run 文档 查看使用 nRet 而不是 obj 的原因,并思考newobj"这个名字的糟糕之处)

(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")