最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp filesystemobject 文件系统例子
时间:2022-06-30 11:41:23 编辑:袖梨 来源:一聚教程网
<%
set fs=server.createobject("scripting.filesystemobject")
if (fs.fileexists("c:windowscursorsxxx.cur"))=true then
response.write("文件 c:windowscursorsxxx.cur 存在。")
else
response.write("文件 c:windowscursorsxxx.cur 不存在。")
end if
set fs=nothing
%>
<%
set fs=server.createobject("scripting.filesystemobject")
if fs.folderexists("c: emp") = true then
response.write("文件夹 c: emp 存在。")
else
response.write("文件夹 c: emp 不存在。")
end if
set fs=nothing
%>
<%
set fs=server.createobject("scripting.filesystemobject")
if fs.driveexists("c:") = true then
response.write("驱动器 c: 存在。")
else
response.write("驱动器 c: 不存在。")
end if
response.write("
")
if fs.driveexists("g:") = true then
response.write("驱动器 g: 存在。")
else
response.write("驱动器 g: 不存在。")
end if
set fs=nothing
%>
由于fso对象包含在scripting 类型库 (scrrun.dll)中,所以在使用前首先需要在在工程中引用这个文件,单击“工程”,“引用”,然后在“引用”对话框中选中“microsoft scripting runtime”前的复选框,然后单击“确定”。
要创建fso对象可以采用两种方法,一种是将一个变量声明为fso对象类型:dim fsotest as new filesystemobject;另一种是通过createobject方法创建一个fso 对象:set fsotest = createobject(“scripting.filesystemobject")。在实际使用中具体采用哪种声明方法,可根据个人的使用习惯而定。
完成了fso对象模型的创建之后,就可以利用创建的对象模型的方法访问下属各个对象的属性来获取所需信息或进行相关操作了,具体的方法在下面结合各个对象分别讲述
相关文章
- 《无期迷途》降临烙印深度介绍 06-16
- 最火2025币圈十大加密货币交易所榜单-最好用比特币交易app币安推荐 06-16
- SNORT币怎么交易-2025币安交易所新手全攻略 06-16
- 《大侠立志传》韩红玉结缘有什么 06-16
- Metaplanet最新购入1,112枚比特币后总持仓突破1万枚大关 06-16
- 《艾塔纪元》奥莉维亚凯撒怎么样 06-16