18.4.1 gettempname方法.html

来自「即学即用JavaScript核心对象参考手册原版光盘」· HTML 代码 · 共 15 行

HTML
15
字号
<script>
  var  ofso = new ActiveXObject("Scripting.FileSystemObject");
  var tempfd=ofso.GetSpecialFolder(2);
  temp=ofso.GetTempName();
  var tempf=tempfd.CreateTextFile(temp);
  tempf.WriteLine("这是一个测试");
  tempf.Close();
  var tempf=ofso.GetFile(ofso.BuildPath(tempfd,temp));
  with (document)
     {
	     write("临时文件路径:<br>"+tempf.Path)
	     write("<br>大小为:"+tempf.Size+"字节")
     }
</script>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?