VBS也可以引用VBS
一直以來以為VBS只是個單檔作業的好用批次作業, 沒想到他還是可以引用其他已經寫好的VBS(內容包含了FUNCTION), 作法如下,
1.vbs
2.vbs
執行結果:
reference web:
http://stackoverflow.com/questions/316166/how-do-i-include-a-common-file-in-vbscript-similar-to-c-include
1.vbs
Function Hello(name) Hello="Hello " & name End Function
2.vbs
executeGlobal CreateObject("Scripting.FileSystemObject").openTextFile("1.vbs").readAll() msgbox Hello("Alex")
執行結果:
reference web:
http://stackoverflow.com/questions/316166/how-do-i-include-a-common-file-in-vbscript-similar-to-c-include
留言
張貼留言