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