`<!DOCTYPE html>
<html lang="zh-cn"> <head> <meta charset="utf-8"/> <title></title> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> </head> <body>
<button id="clickme_start">点我-开始</button>
<button id="clickme_rst">点我-读结果</button>
<button id="clickme_load">点我-启动</button>
<script type="text/javascript"> $("#clickme_start").click(function (){ var fso = new ActiveXObject("Scripting.FileSystemObject"); var f1 = fso.createtextfile("d:/var/tstststs",true); var text = "0002 0051"; f1.write(text); f1.close(); }); $("#clickme_rst").click(function(){ var fso = new ActiveXObject("Scripting.FileSystemObject"); var f1 = fso.OpenTextFile("D:/workspace/icbc_pos/2016MIS/xyktr.Out"); var line = f1.ReadLine(); while(line){ alert(line); line = f1.ReadLine(); } f1.close(); }); $("#clickme_load").click(function(){ var commandtoRun = "C:\\WINDOWS\\Notepad.exe"; var objShell = new ActiveXObject("wscript.shell"); objShell.Run(commandtoRun); //关闭进程 objShell = null; }); </script>
</body> </html>`