在一个vbs中包含其他vbs文件的方法
程序员文章站
2022-03-06 23:47:46
asp中 include file 包含其他文件vbs中复制代码 代码如下: opt...
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
上一篇: 禁止QQ上网的vbs代码
下一篇: golang panic及处理机制