zoukankan      html  css  js  c++  java
  • JS 文件复制

    <script>
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    function readFile(filename) {       
     //var fso = new ActiveXObject("Scripting.FileSystemObject");
            var f = fso.OpenTextFile(filename, 1);
            var s = "";
            while (!f.AtEndOfStream)
                s += f.ReadLine() + "\n";
            f.Close();
            alert(s);


    }

     function writeFile(filename, filecontent) {    
     var f, s;
           // fso = new ActiveXObject("Scripting.FileSystemObject");
         fso.CreateTextFile("", true);
            f = fso.OpenTextFile(filename, 2, true);
            f.WriteLine(filecontent);
            f.Close();
     }

    </script>
    </head>

    <body>
    <input type="button" id="testID" onclick="readFile('C:\\Users\\lkf73943\\Desktop\\TestHtml\\test.txt')" style="50px; height:50px;"/>
    <br />
    <br />
    <input type="button" id="testID_1" onclick="writeFile('C:\\Users\\lkf73943\\Desktop\\TestHtml\\test.txt','lets go!!')" style="50px; height:50px;"/>

    </body>
    </html>

    var shell = new ActiveXObject("Wscript.Shell");
        shell.run("cmd.exe /k "+"d: & cd test & copy cmd.txt+,, & exit");
        shell=null;

  • 相关阅读:
    CXB 闯关游戏
    CXB 移动“哨兵棋子”
    GHOJ 300 Hanoi塔
    攻防世界 web 进阶区 刷题记录
    攻防世界 web 新手练习 刷题记录
    TensorFlow01:增加变量显示+tensorboard可视化
    TensorFlow01:梯度下降
    TensorFlow01:张量
    01深度学习介绍
    05Python爬虫:响应内容写入文件
  • 原文地址:https://www.cnblogs.com/standy225/p/2829216.html
Copyright © 2011-2022 走看看