简体   繁体   English

如何使用casperjs脚本运行外部程序(exe,bat)

[英]How to run external program(exe, bat) withing casperjs script

I have running casperjs program, i want during the script to wait for a few seconds and run exe file. 我有运行casperjs程序,我想在脚本期间等待几秒钟并运行exe文件。 it can be .bat as well. 它也可以是.bat。 and then read the result from text file. 然后从文本文件中读取结果。 as far as i know my only problem right now is to execute the external exe from the caseper program. 据我所知,我现在唯一的问题是从caseper程序执行外部exe。 i notice there is a solution for shell with a child process but how to do it on windows? 我注意到有一个带有子进程的shell的解决方案,但如何在Windows上进行?

Find it! 找到它! Maybe it will help someone... 也许它会帮助某人......

var exec = require('child_process').execFile;
    var test = function(){
           console.log("test is running");
           exec('huh.exe', function(err, ans)
                {
                    console.log(err)
                console.log(ans.toString());
                });  
    }
test();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM