vbscript的fso问题

来源:百度知道 编辑:UC知道 时间:2024/06/04 10:37:05
我用vbscript写了一些语句在下面,可是执行的时候在c盘并未见到新建的文件,请问我该如何的修改呢?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>sohu</title>
<script type="text/vbscript">
Sub CreateFile()
Dim fso, tf
Set fso = server.CreateObject("Scripting.FileSystemObject")
Set tf = fso.CreateTextFile("c:/testfile.txt", True)

End Sub
</script>
</head>

&l

哦,

Set fso = server.CreateObject("Scripting.FileSystemObject")
这是服务端程序的写法,即是ASP的写法,如果在本地用vbscript
Set fso = CreateObject("Scripting.FileSystemObject")
这样写才是正确的。

你亦或可以直接把代码存成ASP

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>sohu</title>
<%
Sub CreateFile()
Dim fso, tf
Set fso = server.CreateObject("Scripting.FileSys