VBS读写文件及创建、删除文件.docxVIP

  • 194
  • 0
  • 约 6页
  • 2016-12-21 发布于北京
  • 举报
VBS读写文件及创建、删除文件 set fso=createobject(scripting.filesystemobject)set zsc=createobject(scripting.dictionary)if (fso.fileexists(a.txt)) then打开文件,参数1为forreading,2为forwriting,8为appendingset file=fso.opentextfile(a.txt,1,ture)else创建文件,参数1为forreading,2为forwriting,8为appendingset file=fso.createtextfile( a.txt,2,ture)写入文件内容,有三种方法:write(x)写入x个字符,writeline写入换行,writeblanklines(n)写入n个空行file.writeline welcome!file.writeline thanks!set file=fso.opentextfile(a.txt,1,ture)end if读取文件内容,有三种方法:read(x)读取x个字符,readline读取一行,readall读取全部读取文件时跳行:skip(x) 跳过x个字符,skipline 跳过一行do while file.atendofstreamtrueline=line+1zsc.a

文档评论(0)

1亿VIP精品文档

相关文档