asp的fso对象小问题

来源:百度知道 编辑:UC知道 时间:2024/06/06 03:04:20
我在VB6中用的fso对象的movefile中,原文件路径和要移动的路径是放在括号里面的,比如fso.movefile("c:\windows\a.txt","d:\a.txt",true),现在来了asp的vbscrip里面提示子程序不能加括号,那就是说在asp里不能根本movefile方法的返回值来确定文件移动是否成功吗?

如果不需要返回值,直接这样写就可以了
fso.movefile "c:\windows\a.txt","d:\a.txt",true

若需要保留返回值,必须这样写:
a=fso.movefile("c:\windows\a.txt","d:\a.txt",true)
前面要有一个变量来接收返回值,

当然也可以匿名引用这个返回值:
Response.write fso.movefile("c:\windows\a.txt","d:\a.txt",true)
或者
if fso.movefile("c:\windows\a.txt","d:\a.txt",true)=True then ...

movefile只有两个参数的。你需要知道执行是否成功的话,只要在执行moviefile之后判断文件是否存在就可以了。

用fso的FileExists()函数判断……
这个请参考VBSCRIP5.CHM的FileSystemObject 对象教程……