Scripting.FileSystemObjectvar tmp = new ActiveXObject("Scripting.FileSystemObject");
对象使用跟在VB或VBS中使用一样,只需要注意大小写,以及一些数组方法等方面的写法,因为VBS中tmp.name,不容易分辨name是一个属性,还是一个无参数方法,也不容易区分tmp.name(1)是一个数组的第一个元素,还是一个函数有一个参数是1.
对象使用跟在VB或VBS中使用一样,只需要注意大小写,以及一些数组方法等方面的写法,因为VBS中tmp.name,不容易分辨name是一个属性,还是一个无参数方法,也不容易区分tmp.name(1)是一个数组的第一个元素,还是一个函数有一个参数是1.
{
var fso, f1, ts, s;
var ForReading = 1;
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fso.CreateTextFile("c:\\testfile.txt", true);
// 写一行。
Response.Write("Writing file <br>");
f1.WriteLine("Hello World");
f1.WriteBlankLines(1);
f1.Close();
// 读取文件的内容。
Response.Write("Reading file <br>");
ts = fso.OpenTextFile("c:\\testfile.txt", ForReading);
s = ts.ReadLine();
Response.Write("File contents = '" + s + "'");
ts.Close();
}
微软脚本帮助文档5.6
含jscript、vbscript等http://download.microsoft.com/download/winscript56/Install/5.6/W982KMe/CN/scd56chs.exe