在一个vbs中包含其他vbs文件的方法
更新时间:2007年03月05日 00:00:00 作者:
asp中 include file 包含其他文件
vbs中
Option Explicit
On Error Resume Next
Sub include(vbs)
Dim fso : Set fso = CreateObject("scripting.FileSystemObject")
Dim p : p = Split(Wscript.ScriptFullName,"\")
p(UBound(p)) = vbs
p = Join(p,"\")
Dim f : Set f = fso.OpenTextFile(p)
Execute f.ReadAll()
' ExecuteGlobal f.ReadAll()
f.Close()
Set f = Nothing
Set fso = Nothing
' Wscript.Echo(p)
End Sub
include("1.vbs")
include("2.vbs")
'If Err Then
' Wscript.Echo(Err.description)
' Wscript.Quit()
'End If
Wscript.Echo(a+b)
1.vbs
a = 3
2.vbs
b = 4
vbs中
复制代码 代码如下:
Option Explicit
On Error Resume Next
Sub include(vbs)
Dim fso : Set fso = CreateObject("scripting.FileSystemObject")
Dim p : p = Split(Wscript.ScriptFullName,"\")
p(UBound(p)) = vbs
p = Join(p,"\")
Dim f : Set f = fso.OpenTextFile(p)
Execute f.ReadAll()
' ExecuteGlobal f.ReadAll()
f.Close()
Set f = Nothing
Set fso = Nothing
' Wscript.Echo(p)
End Sub
include("1.vbs")
include("2.vbs")
'If Err Then
' Wscript.Echo(Err.description)
' Wscript.Quit()
'End If
Wscript.Echo(a+b)
1.vbs
a = 3
2.vbs
b = 4
相关文章
vbscript Split函数用法详解(字符串转数组函数)
本文详细介绍了vbscript中split函数的用法,有关split函数的一些实例,vbscript中split函数的语法介绍,有需要的朋友参考下2014-05-05
最新评论