`
yanzilee9292
  • 浏览: 528255 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

vbscript自定义import函数

 
阅读更多

vbscript本身不提供impot功能,需要自定义

Sub Import(strFile)
Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")
Dim objFs : Set objFs = CreateObject("Scripting.FileSystemObject")
strFile = WshShell.ExpandEnvironmentStrings(strFile)
strFile = objFs.GetAbsolutePathName(strFile)
Dim objFile : Set objFile = objFs.OpenTextFile(strFile)
strCode = objFile.ReadAll
objFile.Close
ExecuteGlobal strCode
End Sub

 

参考: http://gazeek.com/coding/importing-vbs-files-in-your-vbscript-project/

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics