使用powershell运行多个javascripts

时间:2018-01-03 13:10:54

标签: javascript powershell phantomjs

以下两点从我的结尾完成

  1. 我的本​​地机器上有两个不同的幻像js脚本 将捕获屏幕截图并将其保存到本地。

  2. 我有一个powershell脚本通过邮件发送捕获的图像。

  3. 我的要求如下

    需要一个统一脚本,我可以在一个脚本中配置上述两个,然后我将更新我的任务调度程序以运行整合脚本,以便每天下午6点发送邮件。

    我正在寻找powershell作为我的最终整合脚本,它将首先运行幻像js并运行send_mail.ps1。

    我使用了以下命令来运行

     C:\phantomjs-2.1.1-windows\phantomjs-2.1.1-windows\bin> .\phantomjs.exe I:\my_code\capture_screenshot1.js  --> (Capture screenshot and put under C:\Images)
     C:\phantomjs-2.1.1-windows\phantomjs-2.1.1-windows\bin> .\phantomjs.exe I:\my_code\capture_screenshot2.js  --> (Capture screenshot and put under C:\Images)
     C:\phantomjs-2.1.1-windows\phantomjs-2.1.1-windows\bin> cd I:\my_code\
     I:\my_code> .\send_mail.ps1  --> (Send Mail from taking the images from C:\Images)
    

    我只需要一个统一的脚本来运行上面的3个命令。

1 个答案:

答案 0 :(得分:0)

你应该可以从powershell启动phantomjs exe。

这就像是

CD c:\path\to\phantomjs
.\phantomjs.exe I:\my_code\capture_screenshot1.js
.\phantomjs.exe I:\my_code\capture_screenshot2.js
**contents of sendmail.ps1**