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" οnclick="readFile('C:\\Users\\lkf73943\\Desktop\\TestHtml\\test.txt')" style="width:50px; height:50px;"/>
<br />
<br />
<input type="button" id="testID_1" οnclick="writeFile('C:\\Users\\lkf73943\\Desktop\\TestHtml\\test.txt','lets go!!')" style="width: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;

转载于:https://www.cnblogs.com/standy225/archive/2012/12/22/2829216.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值