代码如下,意思是我把一个或多个文件拖上该vbs,然后计算拖上的文件共有多少个。如下代码总是显示不存在文件。。。望纠正。谢谢
dim n,ws,fs,file
on error resume next
set ws=wscript.createobject("wscript.shell")
set fs=wscript.createobject("scripting.filesystemobject")
n=0
file=chr(34) & wscript.arguments(n) & chr(34)
if fs.fileexists(file) then
set ws=wscript.createobject("wscript.shell")
set fs=wscript.createobject("scripting.filesystemobject")
n=0
for i=0 to wscript.arguments.count-1
file=wscript.arguments(n)
if fs.fileexists(file) then
wscript.echo file & "存在"
n=n+1
else
wscript.echo file & "不存在"
end if
next
wscript.echo n作者: s700800900 时间: 2010-6-14 05:52